Warning: session_start(): open(/var/lib/php/sessions/sess_quu501igskpciqhkappv8kvon0, O_RDWR) failed: No space left on device (28) in /var/www/tb-usercake/models/config.php on line 51
Warning: session_start(): Failed to read session data: files (path: /var/lib/php/sessions) in /var/www/tb-usercake/models/config.php on line 51
!7
// The relationship between the white and the black part in a traditional
// Haar-like feature could be much more general. Why do they have to
// touch each other? Why do they need to have the same aspect ratio?
// Only the area of both parts has to be the same.
//
// And even that could be lifted by applying a correction factor
// (area white / area black).
//
// Finally, they can even overlap, then you'd use a factor of
// (non-overlapping white area / non-overlapping black area).
// Or wait. Maybe the formula above is still correct.
//
// No idea if these would be called "generalized Haar features" or what
//
// The general unit returned by a Haar match should be pixels*brightness
// (value can be negative too).
//
// Result classification:
// positive = match
// 0 = non-match (indifferent/not applicable)
// negative = anti-match (Haar feature should be inverted)
srecord Haar(IIntegralImage img, DoubleRect rBlack, DoubleRect rWhite) {
// We arbitrarily normalize to the white area
double get() {
double blackArea = area(rBlack);
double whiteArea = area(rWhite);
double factor = doubleRatio(whiteArea, blackArea);
ret img.pixelSum(rWhite) - img.pixelSum(rBlack) * factor;
}
}