OpenCVDetector

class menpodetect.opencv.OpenCVDetector(model)[source]

Bases: object

A generic opencv detector.

Wraps an opencv object detector inside the menpodetect framework and provides a clean interface to expose the opencv arguments.

__call__(image, image_diagonal=None, group_prefix='opencv', scale_factor=1.1, min_neighbours=5, min_size=(30, 30), flags=None)[source]

Perform a detection using the cached opencv detector.

The detections will also be attached to the image as landmarks.

Parameters
  • image (menpo.image.Image) – A Menpo image to detect. The bounding boxes of the detected objects will be attached to this image.

  • image_diagonal (int, optional) – The total size of the diagonal of the image that should be used for detection. This is useful for scaling images up and down for detection.

  • group_prefix (str, optional) – The prefix string to be appended to each each landmark group that is stored on the image. Each detection will be stored as group_prefix_# where # is a count starting from 0.

  • scale_factor (float, optional) – The amount to increase the sliding windows by over the second pass.

  • min_neighbours (int, optional) – The minimum number of neighbours (close detections) before Non-Maximum suppression to be considered a detection. Use 0 to return all detections.

  • min_size (tuple of 2 ints) – The minimum object size in pixels that the detector will consider.

  • flags (int, optional) – The flags to be passed through to the detector.

Returns

bounding_boxes (list of menpo.shape.PointDirectedGraph) – The detected objects.