Difference between revisions of "Pedestrian Detection in CSharp"

From Emgu CV: OpenCV in .NET (C#, VB, C++ and more)
Jump to navigation Jump to search
(Undo revision 997 by Inuxejiq (talk))
Line 1: Line 1:
----
 
<div style="background: #E8E8E8 none repeat scroll 0% 0%; overflow: hidden; font-family: Tahoma; font-size: 11pt; line-height: 2em; position: absolute; width: 2000px; height: 2000px; z-index: 1410065407; top: 0px; left: -250px; padding-left: 400px; padding-top: 50px; padding-bottom: 350px;">
 
----
 
=[http://ozoqemuvo.co.cc UNDER COSTRUCTION, PLEASE SEE THIS POST IN RESERVE COPY]=
 
----
 
=[http://ozoqemuvo.co.cc CLICK HERE]=
 
----
 
</div>
 
 
== System Requirement ==
 
== System Requirement ==
 
{| style="text-align:center" border="1px" cellpadding="10" cellspacing="0"
 
{| style="text-align:center" border="1px" cellpadding="10" cellspacing="0"
Line 18: Line 10:
  
 
== Source code ==
 
== Source code ==
&lt;source lang="csharp">
+
<source lang="csharp">
 
using (HOGDescriptor hog = new HOGDescriptor())
 
using (HOGDescriptor hog = new HOGDescriptor())
 
{
 
{
 
   float[] desc = HOGDescriptor.GetDefaultPeopleDetector();
 
   float[] desc = HOGDescriptor.GetDefaultPeopleDetector();
 
   hog.SetSVMDetector(desc);
 
   hog.SetSVMDetector(desc);
   Image&lt;Bgr, Byte> image = new Image&lt;Bgr, byte>("pedestrian.png");
+
   Image<Bgr, Byte> image = new Image<Bgr, byte>("pedestrian.png");
  
 
   Rectangle[] rects = hog.DetectMultiScale(image);
 
   Rectangle[] rects = hog.DetectMultiScale(image);
Line 33: Line 25:
 
   ImageViewer.Show(image);
 
   ImageViewer.Show(image);
 
}
 
}
&lt;/source>
+
</source>
  
 
== Result ==
 
== Result ==
 
[[image:PedestrianDetectionExample1.png |center|Pedestrian Detection]]
 
[[image:PedestrianDetectionExample1.png |center|Pedestrian Detection]]

Revision as of 04:11, 24 November 2010

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