Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

single person tracking from video sequence

As a part of my thesis work, I need to build a program for human tracking from video or image sequence like the KTH or IXMAS dataset with the assumptions:

  • Illumination remains unchanged
  • Only one person appear in the scene

The program need to perform in real-time

I have searched a lot but still can not find a good solution.

Please suggest me a good method or an existing program that is suitable.

like image 538
minhduc Avatar asked Feb 02 '12 15:02

minhduc


2 Answers

Case 1 - If camera static

If the camera is static, it is really simple to track one person.

You can apply a method called background subtraction.

  1. 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)

  2. Now start capture from camera. Take first frame,convert both to grayscale, smooth both images to avoid noise.

  3. Subtract background image from frame.

  4. 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.

  5. Now threshold the image for a suitable value.

  6. Apply some erosion to remove small granular noise. Apply dilation after that.

  7. Now find contours. Most probably there will be one contour,ie the person.

  8. Find centroid or whatever you want for this person to track.

Now suppose you don't have a background image, you can find it using cvRunningAvg 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.

Here is the implementation of above method using cvRunningAvg.

Case 2 - Camera not static

Here background subtraction won't give good result, since you can't get a fixed background.

Then OpenCV come with a sample for people detection sample. Use it.

This is the file: peopledetect.cpp

I also recommend you to visit this SOF which deals with almost same problem: How can I detect and track people using OpenCV?

like image 116
Abid Rahman K Avatar answered Dec 10 '22 04:12

Abid Rahman K


One possible solution is to use feature points tracking algorithm. Look at this book: Laganiere Robert - OpenCV 2 Computer Vision Application Programming Cookbook - 2011 p. 266

Full algorithm is already implemented in this book, using opencv.

like image 33
Alex Hoppus Avatar answered Dec 10 '22 05:12

Alex Hoppus