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?
// All we require is white area = black area so the subtraction makes sense.
//
// And even that could be lifted by applying a correction factor
// (area white / area black).
//
// [We should generally start normalizing the result between -1
// (maximum inverted match) and 1 (maximum direct match) at this point
// as now we have two different areas in play so we can't really return
// meaningful "pixels" anymore.]
//
// Finally, black and white can even overlap and the formula doesn't even change.
// Although you may want to boost the result value because it's never
// going to reach -1 or 1 when there is overlap. Not sure how to do
// the actual calculation for that.
//
// So these are... "generalized Haar features"?
//
// Result classification:
//
// positive = match
// 0 = non-match (indifferent/not applicable)
// negative = anti-match (inverted Haar feature found)
srecord Haar(IIntegralImage img, DoubleRect rBlack, DoubleRect rWhite) {
double get() {
double blackArea = area(rBlack);
double whiteArea = area(rWhite);
//double overlappingArea = area(intersectDoubleRects(rBlack, rWhite));
//double boost = ?
double whiteSum = img.pixelSum(rWhite); // this is between 0 and whiteArea*255
double blackSum = img.pixelSum(rBlack); // this is between 0 and blackArea*255
ret (doubleRatio(whiteSum, whiteArea) - doubleRatio(blackSum, blackArea))/255.0;
}
}