views:

80

answers:

3

The camera is about 5 feet away form the subject and when I capture a frame, I need to be able to tell if the frame has a human in it or not.

I have some complicated plans on implementing it, just wondering if any of you know an existing solution that I can use.

+3  A: 

The problem you've stumbled into is actually quite complicated, and it has it's own dedicated field : Computer Vision.

This is a fairly common thing one might do, and as you suggested, you definetly shouldn't reinvent the wheel. I'm not sure if there are any algorithms or open source projects floating around.

I think your best bet is to start to look for academic papers and Computer Science lecture notes.

Here's a paper: A Line-Scan Algorithm for Identifying the Human Body

rlb.usa
+1  A: 

OpenCV is a mature toolset to use to start working with computer vision. Note, though, that it is a very difficult problem, and the tools are correspondingly difficult to understand and use.

If you are not using C++, OpenCV may have been wrapped for you to access with your favorite language. I use Emgu CV with C#: http://www.emgu.com/wiki/index.php/Main_Page.

codekaizen
I know someone working with OpenCV and all this person has uttered since they started are obsceneties in varying tones of loudness. I've heard that OpenCV and VS clash horns with frustratingly obscure errors. And that OpenCV itself has terrible, horrible code.
rlb.usa
@rlb.usa - perhaps this is true, but I haven't had any problems with it. Of course, I just compile it and use it as a library...
codekaizen
@rlb.usa this is definitively not true. OpenCV has highly optimized code, and if you have no clue on why/how code is optimized, you might have problems understanding it. Nevertheless, reading the docs should suffice anyways. OpenCV works very well with VS and never gave me any "obscure errors" and i've been using it a lot
zerm
@rlb.usa - @zerm has a good point, the OpenCV docs are pretty good.
codekaizen
+1  A: 

The histogram of oriented gradients is a technique used to detect humans: Wikipedia HoG

Simply put, the algorithm recognizes humans by the distribution of gradient directions in the image: A circle would have a uniform gradient direction distribution, because all directions are equally frequent along the boundary. A square has a distribution with four peaks at 0°, 90°, 180° and 270°, because that's the only directions of it's boundary. A human has a distinctive direction histogram, too, and that histogram can be recognized by classical machine learning algorithms like a support vector machine or an artificial neural network. I think OpenCV contains an implementation of the HoG algorithm.

nikie