people detector in thousands of jpgs [closed]
- 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?
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)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.
please look at the opencv sample instead.
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?
shouldn't that be just
peopledetect.py img1.png im2.png img3.png ...
?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.
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.