skimage 0.17.2

ParametersReturnsBackRef
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)

Parameters

image : (M, N) ndarray

The region of an integral image for which the features need to be computed.

r : int

Row-coordinate of top left corner of the detection window.

c : int

Column-coordinate of top left corner of the detection window.

width : int

Width of the detection window.

height : int

Height of the detection window.

feature_coord : ndarray of list of tuples or None, optional

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.

color_positive_rectangle : tuple of 3 floats

Floats specifying the color for the positive block. Corresponding values define (R, G, B) values. Default value is red (1, 0, 0).

color_negative_block : tuple of 3 floats

Floats specifying the color for the negative block Corresponding values define (R, G, B) values. Default value is blue (0, 1, 0).

alpha : float

Value in the range [0, 1] that specifies opacity of visualization. 1 - fully transparent, 0 - opaque.

max_n_features : int, default=None

The maximum number of features to be returned. By default, all features are returned.

random_state : int, RandomState instance or None, optional

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.

Returns

features : (M, N), ndarray

An image in which the different features will be added.

Visualization of Haar-like features.

Examples

This example is valid syntax, but we were not able to check execution
>>> import numpy as np
... 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. ]]])
See :

Back References

The following pages refer to to this document either explicitly or contain code examples using this.

skimage.feature.haar.draw_haar_like_feature

Local connectivity graph

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


File: /skimage/feature/haar.py#222
type: <class 'function'>
Commit: