koba / overhead-camera-people-counter

People counting algorithm using an overhead video camera
GNU General Public License v3.0
65 stars 22 forks source link

changing to usb webcam #2

Open Gregoriomartjim opened 6 years ago

Gregoriomartjim commented 6 years ago

Hello

I been looking where did you select the path for the video but i cant find it, could you tell me where is it? i would like to change this program to have a people counter live from a usb webcam, do you have any idea of how i could do it?

Regards

agurod42 commented 6 years ago

Hi @Gregoriomartjim.

The path to the video capture which OpenCV will process is being set using the videoCapturePath field right here:

https://github.com/agurz/overhead-camera-people-counter/blob/c7e7180edb053b9a09664ec30acce5294f20a3db/src/modules/counter/VideoCapturePeopleCounter.cpp#L37


In order to capture video from your webcam you should pass the device index to the VideoCapture object, as it's explained here: https://docs.opencv.org/3.0-beta/doc/py_tutorials/py_gui/py_video_display/py_video_display.html#capture-video-from-camera.

If you change that line 37 on PeopleCounter.cpp so the VideoCapture object receives an integer you can achieve what you want.

I hope this can help you, please let me know if it works for you

Regards