Pedestrian Detection in CSharp: Difference between revisions

From EMGU
Jump to navigation Jump to search
Created page with '== System Requirement == {| style="text-align:center" border="1px" cellpadding="10" cellspacing="0" !Component || Requirement || Detail |- |Emgu CV || [[Version_History#Emgu.CV-…'
 
Line 16: Line 16:
   hog.SetSVMDetector(desc);
   hog.SetSVMDetector(desc);
   Image<Bgr, Byte> image = new Image<Bgr, byte>("pedestrian.png");
   Image<Bgr, Byte> image = new Image<Bgr, byte>("pedestrian.png");
  Stopwatch watch = Stopwatch.StartNew();
 
   Rectangle[] rects = hog.DetectMultiScale(image);
   Rectangle[] rects = hog.DetectMultiScale(image);
  watch.Stop();
 
   foreach (Rectangle rect in rects)
   foreach (Rectangle rect in rects)
   {
   {

Revision as of 04:33, 8 August 2009

System Requirement

Component Requirement Detail
Emgu CV Version 2.0.1.0 Available from SVN only
Operation System Cross Platform


Source code

using (HOGDescriptor hog = new HOGDescriptor())
{
   float[] desc = HOGDescriptor.GetDefaultPeopleDetector();
   hog.SetSVMDetector(desc);
   Image<Bgr, Byte> image = new Image<Bgr, byte>("pedestrian.png");

   Rectangle[] rects = hog.DetectMultiScale(image);

   foreach (Rectangle rect in rects)
   {
      image.Draw(rect, new Bgr(Color.Red), 1);
   }
   ImageViewer.Show(image);
}

Result

Pedestrian Detection
Pedestrian Detection