Ask Your Question
0

beginner question: approaches for detecting a person in front of a store window

asked 2014-01-22 13:51:29 -0600

morganpackard gravatar image

updated 2014-01-22 15:21:43 -0600

I need to read a video stream from a camera mounted about 10 feet in the air, and pointed at a steep downward toward a sidewalk. I simply need to detect if ANY person-sized object has moved into the camera's view, and remained there for a few seconds.

I know this is fairly trivial if I have a controlled environment and a relatively static background. I can remove the background, then run a contour detector. However, if it's an outdoor camera, I'll need to be constantly grabbing new background shots, waiting until the sidewalk is empty before grabbing, which seems far from foolproof.

I've experimented with HOG:

HOGDescriptor hog;
hog.setSVMDetector(HOGDescriptor::getDefaultPeopleDetector());

This seems to give some false positives, and may be more complex than I need (I don't care if an object is a person or not, I just care if it's present and big).

What approach would you all take for simply detecting whether there's a big thing on a sidewalk or not, across a wide range of weather and light conditions?

**** EDIT *******

This looks like it may be most of what I want.

http://docs.opencv.org/trunk/doc/tutorials/video/background_subtraction/background_subtraction.html

edit retag flag offensive close merge delete

Comments

1

the HOG descriptors for people were trained on a plain side-view.

berak gravatar imageberak ( 2014-01-22 14:02:21 -0600 )edit

@berak -- right, so I suppose if I wanted to use HOG I'd need to do some of my own training. More reason to avoid HOG if I can get away with something less sophisticated.

morganpackard gravatar imagemorganpackard ( 2014-01-22 14:06:14 -0600 )edit
1

at least look at backgroundsubtractormog2 for a more sophisticated bg-removal

berak gravatar imageberak ( 2014-01-22 14:20:22 -0600 )edit
1

Sample images will be helpful for more tips.

Vikas gravatar imageVikas ( 2014-01-22 15:54:52 -0600 )edit

I suggest like @berak using the mog2 background subtractor with updating set to true. After that, perform some closing and opening operations on the image to remove noise, maybe even a Gaussian filter before applying the BG subtractor (it removes speckle noise) and then you have an image with white blobs on a black background. Secondly perform a findContours operation and a contourArea to define the size of these contours. This will get you pretty far if you do not want to know if it is actually a person or just a large box walking in front of the camera.

StevenPuttemans gravatar imageStevenPuttemans ( 2014-01-23 04:20:28 -0600 )edit

1 answer

Sort by ยป oldest newest most voted
1

answered 2014-01-22 21:05:14 -0600

MRDaniel gravatar image

Background subtraction is a good start. Such as frame difference or MOG.

This gives you a nice mask of objects that are not in the background. i.e. foreground objects

Get contours of the mask in order to get ROIs, region of interests. The ROI is the contours bounding box.

You can now run Haar or HOG on each ROI. Take the mask image and change it's ROI for each bounding box, and run the detector. HOG seems to be the preferred method, but performs better on a GPU as it's quite intensive. The cascade files are available in the OpenCV source there are many tutorials. Just find a good one on face detection and change the xml file to "people" or "bodies" or whatever it's called.

You now have detections, which are...

a) Not the background. b) Computational inexpensive to compute. c) Probably people.

All of the terms used can be found in OpenCV documentation.

Regards.

edit flag offensive delete link more

Comments

As he mentions he doesn't need to know if it is actually a person, but can just depend on the size of the ROIs, I would just skip the classification altogether. Just computation power that is actually not needed by his demands.

StevenPuttemans gravatar imageStevenPuttemans ( 2014-01-23 04:21:49 -0600 )edit

Question Tools

Stats

Asked: 2014-01-22 13:51:29 -0600

Seen: 706 times

Last updated: Jan 22 '14