phenotypic.abc_.DetectionMode#

class phenotypic.abc_.DetectionMode[source]

Bases: ABC

Base class for detection matrix source modes.

Subclasses define how the detection matrix is computed from raw image data (grayscale, individual RGB channels, etc.).

Methods

__init__

compute

Return a fresh detection matrix from image.

Attributes

name

Short identifier used in detect_mode strings.

requires_rgb

Whether this mode needs RGB data to compute.

abstract property name: str

Short identifier used in detect_mode strings.

abstract property requires_rgb: bool

Whether this mode needs RGB data to compute.

abstract compute(image: Image) np.ndarray[source]

Return a fresh detection matrix from image.

Parameters:

image (Image) – The Image instance to compute from.

Returns:

A 2-D float32 array normalised to [0, 1].

Return type:

np.ndarray