Ask Your Question

ToString's profile - activity

2016-03-16 23:59:08 -0600 asked a question Overhead People counting

Hi,

I am building an overhead people counter as a project, and have made some progress, however, I feel it could be better and more accurate. If anyone has any ideas that would be awesome!

What I have done so far:

  • Use MOG for background subtraction (fiddled with learning rates etc), as well as opening and closing morphological operations.

  • Use contours to return bounding rectangles based on the mask from the Background Subtractor. There is some logic there to ascertain whether a 'blob' is big enough to be a person. This is mainly using cv2.contourArea() method.

  • Then I send this to camshift to track.

  • Create a line in the middle of the frame and track each rectangle until it passes the line, then increment or decrement the counter.

So far this gives so so results. In fact, for single file it is quite decent. However, when there are multiple people in the frame, it gets tricky.

Issues I have which I need help with:

  • Contours join when people are next to each other. My hunch is to use some sort of clustering library (eg. Kmeans and derive k based on the 'guessed' area a person should take up), then build bounding boxes around the centroids. I am unsure if this is a suitable method for this. Especially as people come in all shapes and sizes.

  • Camshift is good, but not great. I have also tried other libraries (dlibs correlation tracker) and still haven't achieved great results. Is there a tracker suitable for this kind of task?

  • HOG is not an option - Unless someone knows something I don't. It is firstly very slow, and secondly, not designed for overhead people. I have read that some people have tried warping overhead images to get them as close to upright poses as possible, and then using HOG, however, I have not heard about this being a successful method.

I use a simple webcam on an Odroid and a cheap fisheye wide angle lens stuck on the top. The fisheye has slight distortion. More precisely, objects in the middle of the frame appear bigger and get smaller the further out they go. This I believe I may able to solve, but tracking and counting reliably is something I wish to get as accurate as possible.

So far the Odroid handles the computation quite well. I get close to 30fps at 640x480 pixels.

Some other things to note about people counting.

  • People are in the frame usually for a small duration and walk in a straight line. They usually enter on one side and exit on the opposite.

  • Thresholding by color is risky, as people wear different clothing/have different hair color. Especially if someone is wearing the same color as the floor.

Anyhow, sorry if this is a big read. I guess I am just out of ideas. If anyone has any that would be sweet. Cheers

Elan

2015-06-25 01:00:40 -0600 received badge  Enthusiast
2015-06-17 01:54:49 -0600 answered a question [Python] FlannBasedMatcher image retrieval

Hi there,

I did a similar project to yourself. See this link for a good example of how to use FLANN matcher.

I suspect your main problem is your architecture, and that you should possibly store the keypoints/descriptors in a file or database for retrieval. Then you can try match 1 by 1 and sort by some sort of metric (this could be domain specific). You could sort by:

  • Total number of matched points.
  • You could assess the generated Homography matrix if you can implement some rules about how the image has projected or transformed.

In my project, I saved the image, keypoints, descriptors and the name of the image, in a database (SQLite). This seemed to work very well. It also helps identify which image you are using.

This should help you get accurate results.