CameraBlockage

class SimpleCameraBlockageResults(blocked_status, duration, std_dev, blocked_ratio)

The results of detect_simple_camera_blockage().

property blocked_status

True if the camera is blocked, False otherwise.

Type

boolean

property duration

The duration of the detection in seconds.

Type

float

property std_dev

The standard deviation for each pixel of the image.

Type

numpy array of floats the same dimension of the input image

property blocked_ratio

The ratio of blocked portion to overall image size.

Type

list of floats if detect_quadrants=True; else float

detect_simple_camera_blockage(image, blocked_threshold=0.9, std_dev_threshold=2.0, detect_quadrants=True)

Detect a camera blockage using a simple standard deviation-based algorithm.

A blockage is detected when the standard deviation falls below a specified level for a portion of the image or quadrant. It is great for detecting simple cases where the blockage has low standard deviation, for example a solid color object. It fails when the blockage also has a high standard deviation, such as a colorful notebook.

Parameters
  • image (numpy array of image in BGR format) – The image to analyze.

  • blocked_threshold (float in range [0, 1]) – The portion of the image that must be under the std_dev_threshold to determine that the camera is blocked. For example, a value of 0.9 means that the camera is considered blocked when 90% of its pixels fall below the std_dev_threshold.

  • std_dev_threshold (float) – The level of the standard deviation to consider for the blockage threshold. For example, a value of 2.0 means that all pixels under a standard deviation of 2.0 are considered blocked.

  • detect_quadrants (boolean) – When True, the blocked_threshold will be applied to each quadrant of an image. If any quadrant is blocked the camera is considered blocked. This is useful to detect when a portion of the field of view is blocked. When False, the blocked_threshold will be applied to the entire image.

Returns

SimpleCameraBlockageResults – The results of the blockage detection.