Domains¶
Creamas includes some utility functions for different artifact domains, i.e. images or language.
TODO: This functionality is currently being developed.
Images¶
Information¶
Various image information functions.
-
creamas.domains.image.image.
channel_portion
(image, channel)[source]¶ Estimates the amount of a color relative to other colors.
- Parameters
image – numpy.ndarray
channel – int
- Returns
portion of a channel in an image
- Return type
-
creamas.domains.image.image.
fractal_dimension
(image)[source]¶ Estimates the fractal dimension of an image with box counting. Counts pixels with value 0 as empty and everything else as non-empty. Input image has to be grayscale.
See, e.g Wikipedia.
- Parameters
image – numpy.ndarray
- Returns
estimation of fractal dimension
- Return type
Features¶
Various feature implementations. Each feature value takes as an input an artifact, and returns feature’s value for that artifact.
Note
OpenCV has to be installed in order for the ImageComplexityFeature and ImageIntensityFeature classes in this module to work. It is not installed as a default dependency.
Use, e.g. pip install opencv-python
-
class
creamas.domains.image.features.
ImageComplexityFeature
[source]¶ Feature that estimates the fractal dimension of an image. The color values must be in range [0, 255] and type
int
. Returns afloat
.- Parameters
-
extract
(artifact)[source]¶ Extract feature’s value from an artifact.
If artifact with a domain not in
domains
is used as a parameter, the function should returnNone
.Note
Dummy implementation, override in a subclass.
- Returns
Value extracted from the artifact.
- Return type
rtype
or None- Raises
NotImplementedError – if not overridden in subclass
-
class
creamas.domains.image.features.
ImageRednessFeature
[source]¶ Feature that measures the redness of an image. Returns a
float
in range [0, 1].- Parameters
-
extract
(artifact)[source]¶ Extract feature’s value from an artifact.
If artifact with a domain not in
domains
is used as a parameter, the function should returnNone
.Note
Dummy implementation, override in a subclass.
- Returns
Value extracted from the artifact.
- Return type
rtype
or None- Raises
NotImplementedError – if not overridden in subclass
-
class
creamas.domains.image.features.
ImageGreennessFeature
[source]¶ Feature that measures the greenness of an image. Returns a
float
in range [0, 1].- Parameters
-
extract
(artifact)[source]¶ Extract feature’s value from an artifact.
If artifact with a domain not in
domains
is used as a parameter, the function should returnNone
.Note
Dummy implementation, override in a subclass.
- Returns
Value extracted from the artifact.
- Return type
rtype
or None- Raises
NotImplementedError – if not overridden in subclass
-
class
creamas.domains.image.features.
ImageBluenessFeature
[source]¶ Feature that measures the blueness of an image. Returns a
float
in range [0, 1].- Parameters
-
extract
(artifact)[source]¶ Extract feature’s value from an artifact.
If artifact with a domain not in
domains
is used as a parameter, the function should returnNone
.Note
Dummy implementation, override in a subclass.
- Returns
Value extracted from the artifact.
- Return type
rtype
or None- Raises
NotImplementedError – if not overridden in subclass
-
class
creamas.domains.image.features.
ImageIntensityFeature
[source]¶ Feature that measures the intensity of an image. Returns a
float
in range [0, 1].- Parameters
-
extract
(artifact)[source]¶ Extract feature’s value from an artifact.
If artifact with a domain not in
domains
is used as a parameter, the function should returnNone
.Note
Dummy implementation, override in a subclass.
- Returns
Value extracted from the artifact.
- Return type
rtype
or None- Raises
NotImplementedError – if not overridden in subclass
Other domains¶
Other domains are currently being developed