I tried to use Eclipse C++ to access See3cam CU40 camera which is in format of Y16 instead of RGB. I have installed required OpenCV library provided by the manufacturer but I encountered problems with libv4l2
.
Example:
#include "opencv2/opencv.hpp"
#include "opencv2/highgui/highgui.hpp"
#include <iostream>
#include <ctype.h>
using namespace cv;
using namespace std;
int main(int, char**)
{
VideoCapture cap(0);
if(!cap.isOpened()){ // check if default camera is opened
cout << "***Could not initialize capturing...***\n";
return -1;
}
Mat edges;
namedWindow("edges",1);
for(;;)
{
Mat frame;
cap >> frame; // get a new frame from camera
cvtColor(frame, edges, CV_BGR2GRAY);
GaussianBlur(edges, edges, Size(7,7), 1.5, 1.5);
Canny(edges, edges, 0, 30, 3);
imshow("edges", edges);
if(waitKey(30) >= 0) break;
}
// the camera will be deinitialized automatically in VideoCapture destructor
return 0;
}
Error in console:
libv4l2: error set_fmt gave us a different result then try_fmt!
HIGHGUI ERROR: libv4l unable convert to requested pixfmt
libv4l2: error set_fmt gave us a different result then try_fmt!
The desired result should be a window containing the edged video streaming captured by the camera, however, the frame was triplicated and somewhat overlapped. Anyone can help with this? Thanks.