0

I am using opencv on my raspberry pi 2 B+ to do real time image processing. I am using raspberry pi's camera and have installed V4l2 driver prior to starting image processing. The problem is that I am getting about 2-3 fps with a delay of about 3 seconds.I am doing a real-time application and am unable to achieve it due to these constraints. Also,when I try to set my frame rate and resolution i get the following errors:

VIDEOIO ERROR: V4L/V4L2 VIDIOC_CROPCAP

VIDEOIO ERROR: setting property #16 is not supported

VIDEOIO ERROR: setting propert #5 is not supported

What can be the possible reason for this problem? Here is my code:

#include <opencv2/opencv.hpp>
#include "opencv2/highgui/highgui.hpp"
#include <stdio.h>
using namespace cv;
using namespace std;
int main( int argc, char** argv ) {
    namedWindow("Camera",WINDOW_AUTOSIZE);
    VideoCapture cap;
    cap.open(0);
    if(!cap.isOpened())
    {
            cout<<"Camera is not accessible"<<endl;
    }
    int width,length;
    double fps;
    fps=60;
    cap.set(CV_CAP_PROP_CONVERT_RGB,false);

    cap.set(CV_CAP_PROP_FPS,fps);
    cap.set(CV_CAP_PROP_FRAME_HEIGHT,240);
    cap.set(CV_CAP_PROP_FRAME_WIDTH,320);
    Mat frame;
    while(1)
    {
        cap>>frame;
        fps = cap.get(CV_CAP_PROP_FPS);
        width =  cap.get(CAP_PROP_FRAME_WIDTH);
        length = cap.get(CAP_PROP_FRAME_HEIGHT); 
        cout<<fps<<endl<<width<<endl<<length<<endl;
        imshow("Camera",frame);
        waitKey(33);
    }
}
 
Community
  • 1
  • 1

0 Answers0