static void Run()
{
using (Mat image = CvInvoke.Imread("cat.jpg", LoadImageType.AnyColor | LoadImageType.AnyDepth))
using (LatentSvmDetector detector = new LatentSvmDetector(new string[] { "cat.xml" }))
{
Stopwatch watch = Stopwatch.StartNew();
MCvObjectDetection[] regions = detector.Detect(image, 0.5f);
watch.Stop();
foreach (MCvObjectDetection region in regions)
{
CvInvoke.Rectangle(image, region.Rect, new MCvScalar(0, 0, 255));
}
ImageViewer.Show(image, String.Format("Object detected in {0} milliseconds", watch.ElapsedMilliseconds));
}
}