draw_haar_like_feature(image, r, c, width, height, feature_coord, color_positive_block=(1.0, 0.0, 0.0), color_negative_block=(0.0, 1.0, 0.0), alpha=0.5, max_n_features=None, random_state=None)
The region of an integral image for which the features need to be computed.
Row-coordinate of top left corner of the detection window.
Column-coordinate of top left corner of the detection window.
Width of the detection window.
Height of the detection window.
The array of coordinates to be extracted. This is useful when you want to recompute only a subset of features. In this case feature_type
needs to be an array containing the type of each feature, as returned by haar_like_feature_coord
. By default, all coordinates are computed.
Floats specifying the color for the positive block. Corresponding values define (R, G, B) values. Default value is red (1, 0, 0).
Floats specifying the color for the negative block Corresponding values define (R, G, B) values. Default value is blue (0, 1, 0).
Value in the range [0, 1] that specifies opacity of visualization. 1 - fully transparent, 0 - opaque.
The maximum number of features to be returned. By default, all features are returned.
If int, random_state is the seed used by the random number generator; If RandomState instance, random_state is the random number generator; If None, the random number generator is the RandomState instance used by :None:None:`np.random`
. The random state is used when generating a set of features smaller than the total number of available features.
An image in which the different features will be added.
Visualization of Haar-like features.
>>> import numpy as npSee :
... from skimage.feature import haar_like_feature_coord
... from skimage.feature import draw_haar_like_feature
... feature_coord, _ = haar_like_feature_coord(2, 2, 'type-4')
... image = draw_haar_like_feature(np.zeros((2, 2)),
... 0, 0, 2, 2,
... feature_coord,
... max_n_features=1)
... image array([[[0. , 0.5, 0. ], [0.5, 0. , 0. ]], <BLANKLINE> [[0.5, 0. , 0. ], [0. , 0.5, 0. ]]])
The following pages refer to to this document either explicitly or contain code examples using this.
skimage.feature.haar.draw_haar_like_feature
Hover to see nodes names; edges to Self not shown, Caped at 50 nodes.
Using a canvas is more power efficient and can get hundred of nodes ; but does not allow hyperlinks; , arrows or text (beyond on hover)
SVG is more flexible but power hungry; and does not scale well to 50 + nodes.
All aboves nodes referred to, (or are referred from) current nodes; Edges from Self to other have been omitted (or all nodes would be connected to the central node "self" which is not useful). Nodes are colored by the library they belong to, and scaled with the number of references pointing them