pub fn number_of_haar_features(width: u32, height: u32) -> u32 {
    let num_positive_features =
        // Two-region horizontal
        num_features(width, 2) * num_features(height, 1)
        // Three-region horizontal
        + num_features(width, 3) * num_features(height, 1)
        // Two-region vertical
        + num_features(width, 1) * num_features(height, 2)
        // Three-region vertical
        + num_features(width, 1) * num_features(height, 3)
        // Four-region
        + num_features(width, 2) * num_features(height, 2);

    num_positive_features * 2
}
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.
src/haar.rs