/// <summary> /// Scales the values of rectangle /// </summary> public static void ScaleRectangle(ref HaarRectangle rect, float scaleRect, float scaleWeight) { rect.ScaledX = (int)(rect.X * scaleRect); rect.ScaledY = (int)(rect.Y * scaleRect); rect.ScaledWidth = (int)(rect.Width * scaleRect); rect.ScaledHeight = (int)(rect.Height * scaleRect); rect.ScaledWeight = rect.Weight * scaleWeight; }
/// <summary> /// Gets the sum of a rectangular feature in an integral image. /// </summary> public static float GetSum(ref HaarRectangle rect, IImage2DUIntA integralImage, int x, int y) { return integralImage.GetIntegralSum(x + rect.ScaledX, y + rect.ScaledY, rect.ScaledWidth, rect.ScaledHeight) * rect.ScaledWeight; }