skimage2.feature.haar_like_feature_coord#

skimage2.feature.haar_like_feature_coord(width, height, feature_type=None)[source]#

Compute the coordinates of Haar-like features.

Parameters:
widthint

Width of the detection window.

heightint

Height of the detection window.

feature_typestr or list of str or None, optional

The type of feature to consider:

  • ‘type-2-x’: 2 rectangles varying along the x axis;

  • ‘type-2-y’: 2 rectangles varying along the y axis;

  • ‘type-3-x’: 3 rectangles varying along the x axis;

  • ‘type-3-y’: 3 rectangles varying along the y axis;

  • ‘type-4’: 4 rectangles varying along x and y axis.

By default all features are extracted.

Returns:
feature_coord(n_features, n_rectangles, 2, 2), ndarray of list of tuple coord

Coordinates of the rectangles for each feature.

feature_type(n_features,), ndarray of str

The corresponding type for each feature.

Examples

>>> import numpy as np
>>> from _skimage2.transform import integral_image
>>> from _skimage2.feature import haar_like_feature_coord
>>> feat_coord, feat_type = haar_like_feature_coord(2, 2, 'type-4')
>>> feat_coord
array([ list([[(0, 0), (0, 0)], [(0, 1), (0, 1)],
              [(1, 1), (1, 1)], [(1, 0), (1, 0)]])], dtype=object)
>>> feat_type
array(['type-4'], dtype=object)