Page 1 of 1

augmented reality from usb webcam, how to 30fps

Posted: Thu Feb 28, 2013 2:38 pm
by iamhuzhe
As mentioned in this post

http://www.raspberrypi.org/phpBB3/viewt ... ty#p208533

and googling, raspberry-pi + webcam + opencv --> display === 1-2 fps

I need to reach 30fps (640x480 or less pixel even), how shall I do it with raspberry-pi?

Would the new on board camera module help? Or use openmax or other video capture/encode/decode framework? (since I don't need complicated visual pattern functions)

Or find other camera modules (such as SPI, I2C) and write kernel mode drivers to talk to the camera directly?

Please advise.

Re: augmented reality from usb webcam, how to 30fps

Posted: Thu Feb 28, 2013 4:42 pm
by skidoobond
If you have motion installed, you can edit the motion.conf file and set framerate=30. Also set the webcam_maxrate = 30.

Re: augmented reality from usb webcam, how to 30fps

Posted: Thu Feb 28, 2013 4:57 pm
by ghans
I'd wait for the camera module.

ghans

Re: augmented reality from usb webcam, how to 30fps

Posted: Sat Mar 02, 2013 2:27 pm
by Gomoto
Using opencv and the fixes from my thread:

http://www.raspberrypi.org/phpBB3/viewt ... 28&t=35689

The raspberry pi achieves 30 FPS at 80% CPU with a Logitech C120 at 320x240.
( 15 FPS at 55% CPU, 5 FPS at 20% CPU)

Code: Select all

#include <cv.h>
#include <highgui.h>

int main( int argc , char **argv )
{
        IplImage *frame = NULL;
        int key = 0;
        CvCapture *capture = NULL;
        /* camera */
        capture = cvCaptureFromCAM(0);
        cvSetCaptureProperty(capture, CV_CAP_PROP_FRAME_WIDTH, 320);
        cvSetCaptureProperty(capture , CV_CAP_PROP_FRAME_HEIGHT, 240);
        /* window */
        cvNamedWindow( "result", CV_WINDOW_AUTOSIZE );
        for(;;)
        {        
                frame = cvQueryFrame( capture );
                if( frame )
                        cvShowImage( "result", frame );
                if ( cvWaitKey( 33 ) >= 0 )
                        break;
        }
        /* free memory */
        cvReleaseCapture( &capture );
        cvDestroyWindow( "result" );
        return 0;
}