Skip to content

Commit

Permalink
Added features documentation and image functions now return floats.
Browse files Browse the repository at this point in the history
  • Loading branch information
Hantula Otto A committed Aug 2, 2017
1 parent 215ff3a commit 7acf8fe
Show file tree
Hide file tree
Showing 3 changed files with 10 additions and 3 deletions.
4 changes: 2 additions & 2 deletions creamas/image.py
Original file line number Diff line number Diff line change
Expand Up @@ -64,7 +64,7 @@ def channel_portion(image, channel):
relative_values = ch - np.sum(rgb, axis=0) / 2
relative_values = np.maximum(np.zeros(ch.shape), relative_values)

return np.average(relative_values) / 255
return float(np.average(relative_values) / 255)


def intensity(image):
Expand All @@ -80,4 +80,4 @@ def intensity(image):
image = cv2.cvtColor(image, cv2.COLOR_RGB2GRAY) / 255
elif issubclass(image.dtype.type, np.integer):
image /= 255
return np.sum(image) / np.prod(image.shape)
return float(np.sum(image) / np.prod(image.shape))
3 changes: 2 additions & 1 deletion docs/source/api.rst
Original file line number Diff line number Diff line change
Expand Up @@ -13,5 +13,6 @@ API Documentation
util
rules
mappers
features
math
logging
logging
6 changes: 6 additions & 0 deletions docs/source/features.rst
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
Features
=======

.. automodule:: creamas.features
:members:
:inherited-members:

0 comments on commit 7acf8fe

Please sign in to comment.