We closed this forum 18 June 2010. It has served us well since 2005 as the ALPHA forum did before it from 2002 to 2005. New discussions are ongoing at the new URL http://forum.processing.org. You'll need to sign up and get a new user account. We're sorry about that inconvenience, but we think it's better in the long run. The content on this forum will remain online.
Page Index Toggle Pages: 1
OpenCV webcam capture lag (Read 1482 times)
OpenCV webcam capture lag
May 13th, 2010, 1:29am
 
im trying to make a motion detection based webcam game and i am following a tutorial which uses opencv to do the motion detection. i noticed that even without any image processing, my computer cant seem to output more than about 12fps and this drops to 5-6fps when pixels are analysed for motion. is there any processing being completed in the background by opencv which can be switched off to increase the framerate, because using the default built in Capture class i can easily hit maximum fps whether i set it to 30/60 or even 300! i guess i could switch to the built in capture class, but i would really like to use opencv if possible because its so easy to detect movement
Re: OpenCV webcam capture lag
Reply #1 - May 13th, 2010, 8:46am
 
nevermind, i just rewrote the code to work with the built in video processing libraries. it works much smoother now, i even had to throttle the fps since if it is too high then the frames it uses for motion detection are captured so quickly that they are almost the same.

just one thing i cant seem to get the same as when using opencv is how to flip an image. i managed to flip the webcam feed using
Code:
    
pushMatrix();
scale(-1.0, 1.0);
image(video, -video.width, 0 );
popMatrix();


however i also have a PImage called movementImg which is a thresholded image to show white pixels where movement is detected, however i cant work out how to flip this image and save it rather than display it with image(). can anyone help me out??

thanks
Page Index Toggle Pages: 1