people detector in thousands of jpgs

asked 2015-01-15 08:34:51 -0500

reggie gravatar image

updated 2015-01-15 08:37:39 -0500

  • I'm trying to sort through thousands of pictures in multiple directories for people.
  • The pictures are from a stationary security camera that takes a jpg each time motion is detected.
  • It is running day and night on a raspberry PI.
  • For computing power i've installed opencv on a windows desktop, for sorting the resulting pictures, for the moment.

Iv'e done some googling around and this looks good

The modified accepted answer on people tracking below:

from cv import *
 file ="C:/Users/dom/Dropbox/eclipse_luna/picdir/test_image.png"
 storage = CreateMemStorage(0) 
 img = LoadImage(file)  # or read from camera

 found = list(HOGDetectMultiScale(img,storage, win_stride=(8,8),padding=(32,32), scale=1.05,group_threshold=2))

Could someone:

1) Explain how this works

2) When I run it I don't get any output, why?

3) Could someone point me in the direction of other simple similar examples / tutorials?

edit retag flag offensive close merge delete

Comments

Normally you should have a detector (xml file that is trained on detecting people based on HOG features) and it is called in the function HOGDetectMultiScale then you may have something as output. Have you seen this? it should be something similar to it. (You should have some kind of load)

thdrksdfthmn gravatar imagethdrksdfthmn ( 2015-01-15 08:46:09 -0500 )edit
3

please, do not use the outdated cv module, but the cv2 api consistently. also, do never trust SO answers from 2010. that's all far outdated.

berak gravatar imageberak ( 2015-01-15 09:28:03 -0500 )edit
2

please look at the opencv sample instead.

berak gravatar imageberak ( 2015-01-15 09:32:46 -0500 )edit

this sample looks good, I ran it, but it just printed out the help message. How do I get jpgs into this program? I think the img variable is the way, but I don't understand line 35 " for fn in it.chain(*map(glob, sys.argv[1:])):" is this line how one gets images into the program to analyze?

reggie gravatar imagereggie ( 2015-01-15 12:37:10 -0500 )edit

shouldn't that be just peopledetect.py img1.png im2.png img3.png ... ?

berak gravatar imageberak ( 2015-01-15 12:48:49 -0500 )edit

That did the trick,Ii'm using eclipse, so I had to edit the run/debug settings for peopledetect.py and add the arguments (pathtopicture/picturename1.jpg pathtopicture/picturename2.jpg etc)

It also didn't like my filenames, probably because they had a lot of "-" in them; so I renamed my filenames too.

It didn't pick out a person just a branch near a person. Is there any way of training it? The pictures of people are quite small and only in a particular area.

reggie gravatar imagereggie ( 2015-01-15 14:15:05 -0500 )edit

If the peoples are only in certain areas, then you can add a mask marking the areas of interest... For training a detector, you'll need a database, good enought, IMO, for getting a better detector. If you have spaces or other caracters (like "-") that are splitting the string of path/filename, the just add the path/filename between double quotes.

thdrksdfthmn gravatar imagethdrksdfthmn ( 2015-01-16 02:30:23 -0500 )edit