darsia.ColorRange#
- class ColorRange(min_color, max_color, color_mode=ColorMode.ABSOLUTE)[source]#
Bases:
objectClass to track the range of colors in an image or a set of images.
Initialize ColorRange from min and max color values.
- Parameters:
- min_color
np.ndarray Minimum color values (RGB).
- max_color
np.ndarray Maximum color values (RGB).
- min_color
Methods
from_images(images[, baseline, mask])Create a ColorRange from a list of images.
load(path)Load color range from a json file.
load_from_dict(data)Load color range from a dictionary.
save(path)Save color range to a json file.
to_dict()Convert color range to a dictionary.
Attributes
Minimum color observed.
Maximum color observed.
Whether the color range is relative to a baseline.
Tuple of color ranges observed.
Center of the color range.
Color extent observed.
- classmethod from_images(images, baseline=None, mask=None, **kwargs)[source]#
Create a ColorRange from a list of images.
- Parameters:
- images
list[darsia.Image] List of images to analyze.
- baseline
darsia.Image,optional Baseline image for relative color range.
- mask
darsia.Image,optional Mask image to restrict analysis area.
- images
- classmethod load(path)[source]#
Load color range from a json file.
- Parameters:
- path
Path Path to the json file.
- path
- Returns:
ColorRangeLoaded color range.
- classmethod load_from_dict(data)[source]#
Load color range from a dictionary.
- Parameters:
- data
dict Dictionary representation of the color range.
- data
- Returns:
ColorRangeLoaded color range.
- to_dict()[source]#
Convert color range to a dictionary.
- Returns:
dictDictionary representation of the color range.
- center#
Center of the color range.
- color_mode#
Whether the color range is relative to a baseline.
- extent#
Color extent observed.
- max_color#
Maximum color observed.
- min_color#
Minimum color observed.
- range#
Tuple of color ranges observed.