banana pi camera not working

asked 2015-08-11 22:20:17 -0600

Gordon gravatar image

updated 2015-08-12 03:49:19 -0600

I got a Banana Pi with the Banana Pi Camera. I would like to get a video stream with OpenCV.

The Banana Pi runs current Bananian (uname: bananapi 3.4.104-bananian, lsb_release: Debian GNU/Linux 7.8 (wheezy)) and using the stock OpenCV (opencv_2.3.1-11).

When the program (please find attached) is running, it gives the error message: VIDIOC_QUERYMENU: Inappropriate ioctl for device

and does not display the correct image from the camera.

What is wrong with it?

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

using namespace std;

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

    int t = 0;

    cvNamedWindow("Webcam", CV_WINDOW_AUTOSIZE);

    CvCapture* capture = 0;
    capture = cvCaptureFromCAM(-1);

    if (!capture) {
        printf("could not open camera device");
        fflush(stdout);
    }

    IplImage *frame;

    while(TRUE){
        cvGrabFrame(capture);
        // add cvGrabFrame to always use the specific buffer:
        cvGrabFrame(capture);
        cvGrabFrame(capture);
        cvGrabFrame(capture);
        frame = cvRetrieveFrame(capture, 0);
        cvShowImage("Webcam", frame);

        if(cvWaitKey(10) >= 0) break;
    }

    cvReleaseCapture(&capture);
    cvDestroyWindow("Webcam");

    return EXIT_SUCCESS;
}
edit retag flag offensive close merge delete

Comments

2

just saying - you should neither use opencv2.3.1 (outdated) nor opencv's c-api (deprecated)

berak gravatar imageberak ( 2015-08-12 03:47:53 -0600 )edit