class documentation

Compare images with a known background in LUV colourspace.

This uses an LUV colour space checking only the mean and standard deviation of the U and V channels. The LUV colourspace as it collect colours together in a human- intuitive way.

Method background_mask Calculate a binary image, showing whether each pixel is background.
Method get_sample_coverage Return the percentage of the input image that is background.
Method image_is_sample Label the current image as either background or sample.
Method set_background Use the input image to update the background distributions.
Instance Variable background_data The statistics of the background image.

Inherited from BackgroundDetectAlgorithm:

Method __init__ Initialise the algorithm settings.
Method background_data.setter Set the statistics for the background image.
Method settings.setter Undocumented
Property settings The statistics of the background image.
Property status The status information needed for the GUI. Read only.
Instance Variable _background_data Undocumented
Instance Variable _settings Undocumented
def background_mask(self, image: np.ndarray) -> np.ndarray: (source)

Calculate a binary image, showing whether each pixel is background.

True is background.

The image should be in LUV format, the output will be binary with the same shape in the first two dimensions.

def get_sample_coverage(self, image: np.ndarray) -> float: (source)

Return the percentage of the input image that is background.

Evaluate whether it is foreground or background by comparing it to the saved statistics for a background image on a per-pixel basis

Returns
floatA value (between 0 and 100) is the percentage of the image that is sample.
def image_is_sample(self, image: np.ndarray) -> tuple[bool, str]: (source)

Label the current image as either background or sample.

Returns
tuple[bool, str]A tuple of the result (boolean), and explanation string. The explanation string is formatted so it can be added into a sentence such as An action was taken because the image is {message}.
def set_background(self, image: np.ndarray): (source)

Use the input image to update the background distributions.