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