Note that there are some explanatory texts on larger screens.

plurals
  1. PO
    primarykey
    data
    text
    <p><strong>Case 1 - If camera static</strong></p> <p>If the camera is static, it is really simple to track one person.</p> <p>You can apply a method called background subtraction. </p> <ol> <li><p>Here, for better results, you need a bare image from camera, with no persons in it. It is the background. ( It can also be done, even if you don't have this background image. But if you have it, better. I will tell at end what to do if no background image)</p></li> <li><p>Now start capture from camera. Take first frame,convert both to grayscale, smooth both images to avoid noise.</p></li> <li><p>Subtract background image from frame. </p></li> <li><p>If the frame has no change wrt background image (ie no person), you get a black image ( Of course there will be some noise, we can remove it). If there is change, ie person walked into frame, you will get an image with person and background as black.</p></li> <li><p>Now threshold the image for a suitable value.</p></li> <li><p>Apply some erosion to remove small granular noise. Apply dilation after that.</p></li> <li><p>Now find contours. Most probably there will be one contour,ie the person. </p></li> <li><p>Find centroid or whatever you want for this person to track. </p></li> </ol> <p>Now suppose you don't have a background image, you can find it using <a href="http://opencv.willowgarage.com/documentation/c/imgproc_motion_analysis_and_object_tracking.html?highlight=cvrunningavg#runningavg" rel="nofollow noreferrer"><code>cvRunningAvg</code></a> function. It finds running average of frames from your video which you use to track. But you can obviously understand, first method is better, if you get background image.</p> <p><a href="http://sundararajana.blogspot.in/2007/05/motion-detection-using-opencv.html" rel="nofollow noreferrer">Here is the implementation</a> of above method using cvRunningAvg.</p> <p><strong>Case 2 - Camera not static</strong></p> <p>Here background subtraction won't give good result, since you can't get a fixed background.</p> <p>Then OpenCV come with a sample for people detection sample. Use it.</p> <p>This is the file: <a href="https://code.ros.org/trac/opencv/browser/trunk/opencv/samples/cpp/peopledetect.cpp" rel="nofollow noreferrer">peopledetect.cpp</a></p> <p>I also recommend you to visit this SOF which deals with almost same problem: <a href="https://stackoverflow.com/questions/2188646/how-can-i-detect-and-track-people-using-opencv">How can I detect and track people using OpenCV?</a></p>
    singulars
    1. This table or related slice is empty.
    plurals
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. VO
      singulars
      1. This table or related slice is empty.
    2. VO
      singulars
      1. This table or related slice is empty.
    3. VO
      singulars
      1. This table or related slice is empty.
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload