Question

I want to count number of people crossing a line from either side. I have a camera that is placed on ceiling and shooting for the floor where the line is (So camera sees just top of people heads; and so it is more of object detection than people detection).

Is there any sample solution for this problem or similar problems like this? So I can learn from them?

Edit 1: More than one person is crossing the line at any moment.

Was it helpful?

Solution

If nothing else but humans are subject to cross the line then you need not to detect people you only have to detect motion. There are several approaches for motoin detection.

Probably the simplest one fits your goals. You simply calculate difference between successive frames of video stream and this way determine "motion mask" and thus detect line crossing event

As an improvement of this "algorithm" you may consider "running average" method.

To determine a direction of motion you can use "motion templates".

In order to increase accuracy of your detector you may try any background subtraction technique (which in turn is not a simple solution). For example, if there is some moving background which should be filtered out (e.g. using statistical learning)

All algorithms mentioned are included in OpenCV library.

UPD:

OTHER TIPS

I'm not an expert in video-based cv, but if you can reduce the problem into a finite set of images (for instance, entering frame, standing on line, exiting frame), then you can use one of many shape recognition algorithms. I know of Shape Context which is good, but I doubt if it subtle enough for this application (it won't tell the difference between a head and most other round objects).

Basically, try to extract key images from the video, and then test them with shape recognition algorithms.

P.S. Finding the key images might be possible with good motion detection methods.

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top