[][src]Function imageproc::haar::number_of_haar_features

pub fn number_of_haar_features(width: u32, height: u32) -> u32

Returns the number of distinct Haar-like features for an image of the given dimensions.

Includes positive and negative, two and three region, vertical and horizontal features, as well as positive and negative four region features.

Consider a k-region horizontal feature in an image of height 1 and width w. The largest valid block size for such a feature is M = floor(w / k), and for a block size s there are (w + 1) - 2 * s valid locations for the leftmost column of this feature. Summing over s gives M * (w + 1) - k * [(M * (M + 1)) / 2].

An equivalent argument applies vertically.