Raspicam dont work at 90fps - Raspberry Pi Forums


i have preferred using raspicam since promised work @ 90fps.

first of all, c++ did not recognize raspicam when plugged in. needed use library below work raspicam (and opencv).
http://www.uco.es/investiga/grupos/ava/node/40

however, no matter do, raspicam fails provide 90fps. instead, stucks somewhere around 30fps @ 640x480 grayscale image. why that? please me through annoying performance issue.

below test code used:

#include <ctime>
#include <iostream>
#include <raspicam/raspicam_cv.h>
using namespace std;

int main ( int argc,char **argv ) {

time_t timer_begin,timer_end;
raspicam::raspicam_cv camera;
cv::mat image;
int ncount=100;
//set camera params
camera.set( cv_cap_prop_format, cv_8uc1 );
camera.set( cv_cap_prop_frame_width, 640 );
camera.set( cv_cap_prop_frame_height, 480 );
camera.set( cv_cap_prop_fps, 90 );
//open camera
cout<<"opening camera..."<<endl;
if (!camera.open()) {cerr<<"error opening camera"<<endl;return -1;}
//start capture
cout<<"capturing "<<ncount<<" frames ...."<<endl;
time ( &timer_begin );
( int i=0; i<ncount; i++ ) {
camera.grab();
camera.retrieve ( image);
if ( i%5==0 ) cout<<"\r captured "<<i<<" images"<<std::flush;
}
cout<<"stop camera..."<<endl;
camera.release();
//show time statistics
time ( &timer_end ); /* current time; same as: timer = time(null) */
double secondselapsed = difftime ( timer_end,timer_begin );
cout<< secondselapsed<<" seconds "<< ncount<<" frames : fps = "<< ( float ) ( ( float ) ( ncount ) /secondselapsed ) <<endl;
//save image
cv::imwrite("raspicam_cv_image.jpg",image);
cout<<"image saved @ raspicam_cv_image.jpg"<<endl;
}

don't blame platform choice of software.

raspicam library source @ https://sourceforge.net/projects/raspic ... p/download not support cv_cap_prop_fps, deliver 30fps.

whilst may not official version, appears have been forked github , has been updated more there (and easier link to).
in there you'll see
https://github.com/cedricve/raspicam/bl ... cv.cpp#l96

code: select all

        case cv_cap_prop_fps:             return 30;
, no set method it. , @ https://github.com/cedricve/raspicam/bl ... pl.cpp#l71

code: select all

 state.framerate = 30;
, nothing further modifies framerate, used set frame rate on camera.

you'll either need make modifications raspicam, or alternatives.


raspberrypi



Comments

Popular posts from this blog

invalid use of void expresion in FlexiTimer2 library

error: a function-definition is not allowed here before '{' token

LED Strip Code