Raspberry Pi video tracking performance is slow
Hello!
I've been working on a sentry gun project I found on youtube a while back, and I've run into a huge issue. Code I'm using can be found here: https://github.com/atainter/Tracking-...
When nothing is moving in front of the camera, the framerate is good (20+ FPS), but when I move my hand in front of the camera, and it detects it (and draws a bounding box around it) the framerate drops to something like 1 frame per 2 seconds. On the YouTube video itself: https://youtu.be/HoRPWUl_sF8?t=33m57s it shows their turret running at a reasonably high framerate (15+ FPS). The RPi has to process each frame that the camera sends to it, and from the information on the frame, sends a command to the motors on the turret. The problem I have with the framerate is that if its running at 1 frame every 3 seconds then my turret is practically useless because its making one small adjustment every 3 seconds. I'm running OpenCV 3.1.0. Might upgrading OpenCV solve this issue?
Thanks for the reply!
-Others have successfully replicated the project shown with the exact code, I think the problem is different.
-I've tried to lower the camera resolution to 100x100px but there was no performance increase.
-I'm using a RPi 3. I know that older models are slow.
Maybe its a problem with my OpenCV installation? Even when the FPS is tanking, CPU usage does not exceed 25%.
"I've tried to lower the camera resolution to 100x100px" -- you have to check the result value from cap.set(...). only specific formats will be supported, 100x100 is unlikely, 320x240 likely.
"Maybe its a problem with my OpenCV installation" -- well, how did you do that ? check cv2.getBuildInformation(), for hw support compiled in. tbb, neon ? when in doubt, you'll have to compile your own cv2 locally, with optimisation libs installed before.
"Others... " -- ...
Did you solve the issue ? If yes, then can you share your solution