ovl.thresholds.binary_threshold module

class ovl.thresholds.binary_threshold.BinaryThreshold(threshold: int = None, upper_bound: int = None, threshold_type: Union[ovl.thresholds.binary_threshold.BinaryThresholdType, int] = <BinaryThresholdType.Binary: 0>, otsu=False)[source]

Bases: ovl.thresholds.threshold.Threshold

Creates binary image (masks) from greyscale images (black and white images) The basic Binary Thresholding turns all pixels that are greater or equal to the threshold parameter and smaller or equal to the parameter upper_bound

For more information about the algorithms used: https://docs.opencv.org/trunk/d7/d4d/tutorial_py_thresholding.html

convert(image: numpy.ndarray) → numpy.ndarray[source]

Converts a greyscale image to a binary image using Binary thresholding. :param image: an opened image (numpy ndarray) :return:

validate(*args, **kwargs) → bool[source]

Validates that the parameters for the Threshold are valid

Parameters:
  • args
  • kwargs
Returns:

class ovl.thresholds.binary_threshold.BinaryThresholdType[source]

Bases: enum.IntEnum

An enumeration.

Binary = 0
BinaryInverted = 1
ToZero = 3
ToZeroInverted = 4
Truncate = 2
ovl.thresholds.binary_threshold.is_valid_threshold_type(threshold_type)[source]