public void MaxSizeTest()
{
HaarCascade cascade = new FaceHaarCascade();
HaarObjectDetector target = new HaarObjectDetector(cascade,
50, ObjectDetectorSearchMode.Default);
Bitmap bmp = Properties.Resources.lena_color;
Rectangle[] result;
target.MaxSize = new Size(10, 60);
result = target.ProcessFrame(bmp);
Assert.AreEqual(0, result.Length);
target.MaxSize = new Size(60, 60);
result = target.ProcessFrame(bmp);
Assert.AreEqual(1, result.Length);
foreach (var r in result)
{
Assert.IsTrue(r.Width <= target.MaxSize.Width);
Assert.IsTrue(r.Height <= target.MaxSize.Height);
}
target.MaxSize = new Size(80, 80);
result = target.ProcessFrame(bmp);
Assert.AreEqual(2, result.Length);
foreach (var r in result)
{
Assert.IsTrue(r.Width <= target.MaxSize.Width);
Assert.IsTrue(r.Height <= target.MaxSize.Height);
}
}
}