iamhuzhe
Posts: 5
Joined: Thu Feb 28, 2013 2:18 pm

augmented reality from usb webcam, how to 30fps

Thu Feb 28, 2013 2:38 pm

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.

User avatar
skidoobond
Posts: 40
Joined: Mon Feb 25, 2013 8:26 pm

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

Thu Feb 28, 2013 4:42 pm

If you have motion installed, you can edit the motion.conf file and set framerate=30. Also set the webcam_maxrate = 30.

ghans
Posts: 7882
Joined: Mon Dec 12, 2011 8:30 pm
Location: Germany

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

Thu Feb 28, 2013 4:57 pm

I'd wait for the camera module.

ghans
• Don't like the board ? Missing features ? Change to the prosilver theme ! You can find it in your settings.
• Don't like to search the forum BEFORE posting 'cos it's useless ? Try googling : yoursearchtermshere site:raspberrypi.org

Gomoto
Posts: 126
Joined: Tue Feb 12, 2013 1:21 am

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

Sat Mar 02, 2013 2:27 pm

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;
}

Return to “Graphics, sound and multimedia”