I build the source code as a ROS-NODE, and i rosrun the node in TX2 board
there is a Error :
Error “V4L2: Pixel format of incoming image is unsupported by OpenCV”
ERROR! Unable to open camera
//VideoCapture cap(“nvcamerasrc ! video/x-raw(memory:NVMM), width=(int)1280, height=(int)720,format=(string)I420, framerate=(fraction)24/1 ! nvvidconv flip-method=2 ! video/x-raw, format=(string)BGRx ! videoconvert ! video/x-raw, format=(string)BGR ! appsink”);
//Mat frame;
//— INITIALIZE VIDEOCAPTURE
VideoCapture cap(0);
// open the default camera using default API //cap.open(-1);
// OR advance usage: select any API backend
//int deviceID = -1; // 0 = open default camera
//int apiID = cv::CAP_ANY; // 0 = autodetect default API
// open selected camera using selected API //cap.open(deviceID + apiID);
// check if we succeeded
if (!cap.isOpened()) {
cerr << “ERROR! Unable to open camera\n”;
return -1;
}
cout << “Start grabbing” << endl
<< “Press any key to terminate” << endl;
for(;;)
{ Mat frame;
// wait for a new frame from camera and store it into ‘frame’
cap.read(frame);
// check if we succeeded
if (frame.empty()) {
cerr << “ERROR! blank frame grabbed\n”;
break;
}
// show live and wait for a key with timeout long enough to show images
imshow(“TJUAE”, frame);
if (waitKey(5) >= 0)
break;
}
return 0;
}
Thanks!
I installed v4l-utils and then i saw the result of “v4l2-ctl -d /dev/video0 --list-formats”
the result is :
ioctl: VIDIOC_ENUM_FMT
Index : 0
Type : Video Capture
Pixel Format: ‘RGGB’
Name : 8-bit Bayer RGRG/GBGB
Index : 1
Type : Video Capture
Pixel Format: 'RG10'
Name : 10-bit Bayer RGRG/GBGB
Index : 2
Type : Video Capture
Pixel Format: 'BG10'
Name : 10-bit Bayer BGBG/GRGR
Index : 3
Type : Video Capture
Pixel Format: 'RG12'
Name : 12-bit Bayer RGRG/GBGB
But there is still a problem:
I can see the image when i use cap(1), it will use my USB camera.
I have the same problem, the call to v4l2-ctl -d /dev/video0 --list-formats gives the same answer on my Jetson TX2 as above but on my PC with Ubuntu 16.04 it says
ioctl: VIDIOC_ENUM_FMT
Index : 0
Type : Video Capture
Pixel Format : ‘YUYV’
Name : YUYV 4:2:2
Index : 1
Type : Video Capture
Pixel Format : ‘MJPG’ (compressed)
Name : Motion-JPEG
When I use the instruction cv::VideoCapture.set(CV_CAP_PROP_FOURCC, CV_FOURCC(‘Y’, ‘1’, ‘6’, ’ ')); I get the answer VIDEOIO ERROR: V4L2: setting property #6 not supported
Note that I am using a Tara stereo camera from e-con Systems and openCV-3.1.0, which is required by their SDK
Basically the images I am getting are rubbish, any idea ?
ioctl: VIDIOC_ENUM_FMT
Index : 0
Type : Video Capture
Pixel Format: 'RGGB'
Name : 8-bit Bayer RGRG/GBGB
Index : 1
Type : Video Capture
Pixel Format: 'RG10'
Name : 10-bit Bayer RGRG/GBGB
Index : 2
Type : Video Capture
Pixel Format: 'BG10'
Name : 10-bit Bayer BGBG/GRGR
Index : 3
Type : Video Capture
Pixel Format: 'RG12'
Name : 12-bit Bayer RGRG/GBGB
I did cmake with following option:
D WITH_LIBV4L=ON
Following is build_information part for videoio:
-- Video I/O:
-- DC1394 1.x: NO
-- DC1394 2.x: NO
-- FFMPEG: YES
-- avcodec: YES (ver 56.60.100)
-- avformat: YES (ver 56.40.101)
-- avutil: YES (ver 54.31.100)
-- swscale: YES (ver 3.1.101)
-- avresample: NO
-- GStreamer: NO
-- OpenNI: NO
-- OpenNI PrimeSensor Modules: NO
-- OpenNI2: NO
-- PvAPI: NO
-- GigEVisionSDK: NO
-- Aravis SDK: NO
-- UniCap: NO
-- UniCap ucil: NO
-- V4L/V4L2: NO/YES
-- XIMEA: NO
-- Xine: NO
-- Intel Media SDK: NO
-- gPhoto2: NO