本文整理匯總了C#中System.Drawing.FastBitmap.GetSum2方法的典型用法代碼示例。如果您正苦於以下問題:C# FastBitmap.GetSum2方法的具體用法?C# FastBitmap.GetSum2怎麽用?C# FastBitmap.GetSum2使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在類System.Drawing.FastBitmap
的用法示例。
在下文中一共展示了FastBitmap.GetSum2方法的1個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的C#代碼示例。
示例1: Compute
/// <summary>
/// Detects the presence of an object in a given window.
/// </summary>
public bool Compute(FastBitmap image, Rectangle rectangle)
{
int x = rectangle.X;
int y = rectangle.Y;
int w = rectangle.Width;
int h = rectangle.Height;
double mean = image.GetSum(x, y, w, h) * invArea;
double var = image.GetSum2(x, y, w, h) * invArea - (mean * mean);
double sdev = (var >= 0) ? Math.Sqrt(var) : 1;
// For each classification stage in the cascade
foreach (HaarCascadeStage stage in cascade.Stages)
{
// Check if the stage has rejected the image
if (stage.Classify(image, x, y, sdev) == false)
{
return false; // The image has been rejected.
}
}
// If the object has gone all stages and has not
// been rejected, the object has been detected.
return true; // The image has been detected.
}