isimple.maths package¶
Submodules¶
isimple.maths.colors module¶
-
class
isimple.maths.colors.Color(*args, **kwargs)[source]¶ Bases:
isimple.core.config.BaseConfig-
np3d¶
-
list¶
-
-
class
isimple.maths.colors.HsvColor(*args, **kwargs)[source]¶ Bases:
isimple.maths.colors.Color
-
class
isimple.maths.colors.RgbColor(*args, **kwargs)[source]¶ Bases:
isimple.maths.colors.Color
-
class
isimple.maths.colors.BgrColor(*args, **kwargs)[source]¶ Bases:
isimple.maths.colors.Color
-
isimple.maths.colors.convert(color: isimple.maths.colors.Color, to: Type[isimple.maths.colors.Color]) → isimple.maths.colors.Color[source]¶
-
isimple.maths.colors.as_hsv(color: isimple.maths.colors.Color) → isimple.maths.colors.HsvColor[source]¶
-
isimple.maths.colors.as_bgr(color: isimple.maths.colors.Color) → isimple.maths.colors.BgrColor[source]¶
-
isimple.maths.colors.as_rgb(color: isimple.maths.colors.Color) → isimple.maths.colors.RgbColor[source]¶
isimple.maths.coordinates module¶
-
class
isimple.maths.coordinates.Coo[source]¶ Bases:
isimple.core.config.BaseConfigImage coordinate
-
rel¶
-
list¶
-
-
class
isimple.maths.coordinates.ShapeCoo[source]¶ Bases:
isimple.maths.coordinates.Coo-
abs¶
-
idx¶
-
cv2¶
-
-
class
isimple.maths.coordinates.Roi[source]¶ Bases:
isimple.core.config.BaseConfigRegion of interest
isimple.maths.images module¶
-
isimple.maths.images.overlay(frame: numpy.ndarray, overlay: numpy.ndarray, alpha: float = 0.5) → numpy.ndarray[source]¶ Overlay frame image with overlay image. * Both images should be in the BGR color space
-
isimple.maths.images.crop_mask(mask: numpy.ndarray) → Tuple[numpy.ndarray, numpy.ndarray, Tuple[int, int]][source]¶ Crop a binary mask image array to its minimal (rectangular) size to exclude unnecessary regions
-
isimple.maths.images.rect_contains(rect: numpy.ndarray, point: isimple.maths.coordinates.ShapeCoo) → bool[source]¶ Check whether point is in rect :param rect: an ‘array rectangle’: [first_row, last_row, first_column, last_column] :param point: a coordinate as (row, column) :return:
-
isimple.maths.images.area_pixelsum(image)[source]¶ Calculate area in px^2 by summing pixels
Parameters: image – Binary input image (numpy array). Should already be masked and filtered. Returns: Area as # of pixels
-
isimple.maths.images.to_mask(image: numpy.ndarray, kernel: numpy.ndarray = array([[ 0, 0, 0, 255, 0, 0, 0], [ 0, 255, 255, 255, 255, 255, 0], [ 0, 255, 255, 255, 255, 255, 0], [255, 255, 255, 255, 255, 255, 255], [ 0, 255, 255, 255, 255, 255, 0], [ 0, 255, 255, 255, 255, 255, 0], [ 0, 0, 0, 255, 0, 0, 0]], dtype=uint8)) → numpy.ndarray[source]¶ Convert a .png image to a binary mask