VideoCapture Slows Down OpenGL Program
I've written a pong video game that uses object tracking with a camera to position the paddle of the player. Everything was running smoothly until I begun grabbing input from the camera. Now the game draws very slowly and messes up game play. Is grabbing the images from the camera just slow or is this a combination of opengl and opencv slowing down the program? I am using SDL as well as the highgui module from opencv, is the conflict between the windowing API wrapers causing this issue?
Have you checked your CPU and RAM usage during the execution of the program? If so then what is the output? How busy is your system? Both of the above will give you some idea about what you are doing and where you are going wrong.
CPU usage is under 50% and RAM usage is 25.8%, perhaps the maximum speed allocated for the single thread running the program is too slow. Would adding another thread to pull camera images remedy this problem? A partial fix I am using right now is slowing down the rate of taking images from the camera (waiting 25ms between each), results are somewhat better, but still not good enough.
Yes try that. If not tell me, I'll try looking at it over the weekend.
Adding another thread did not increase perfromance. This seems to mean that both OpenGL and OpenCV are using the GPU, thus the slow rendering performance. Any suggestions are appreciated. I can't imagine my program requiring the need for OpenCL (the program is rather small), but it seems the only alternative.