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