VIDEOIO ERROR: V4L: device nvcamerasrc ! video/x-raw(memory:NVMM), width=(int)1920, height=(int)1080,format=(string)I420, framerate=(fraction)30/1 ! nvvidconv flip-method=2 ! video/x-raw, format=(string)BGRx ! videoconvert ! video/x-raw, format=(string)BGR ! appsink: Unable to query number of channels
however it can captures frames well.
Source is located at ubuntu@tegra-ubuntu:~/opencv-3.2.0/samples/cpp/example_cmake/example.cpp as below
#include "opencv2/core.hpp"
#include "opencv2/imgproc.hpp"
#include "opencv2/highgui.hpp"
#include "opencv2/videoio.hpp"
#include <iostream>
using namespace cv;
using namespace std;
void drawText(Mat & image);
int main()
{
cout << __LINE__ << ": Built with OpenCV " << CV_VERSION << endl;
Mat image;
VideoCapture capture("nvcamerasrc ! video/x-raw(memory:NVMM), width=(int)1920, height=(int)1080,format=(string)I420, framerate=(fraction)30/1 ! nvvidconv flip-method=2 ! video/x-raw, format=(string)BGRx ! videoconvert ! video/x-raw, format=(string)BGR ! appsink");
// capture.open(0);
if(capture.isOpened())
{
cout << __LINE__ << ": Capture is opened" << endl;
for(;;)
{
capture >> image;
if(image.empty())
{
cout << __LINE__ << ": Empty, break" << endl;
break;
}
drawText(image);
imshow("Sample", image);
if(waitKey(33) == 27)
{
cout << __LINE__ << ": Esc, break" << endl;
break;
}
}
}
else
{
cout << "No capture" << endl;
image = Mat::zeros(480, 640, CV_8UC1);
drawText(image);
imshow("Sample", image);
waitKey(0);
}
return 0;
}
void drawText(Mat & image)
{
putText(image, "Hello OpenCV",
Point(20, 50),
FONT_HERSHEY_COMPLEX, 1, // font face and scale
Scalar(255, 255, 255), // white
1, LINE_AA); // line thickness and type
}
log as below
ubuntu@tegra-ubuntu:~/opencv-3.2.0/samples/cpp/example_cmake$ export GST_DEBUG=3
ubuntu@tegra-ubuntu:~/opencv-3.2.0/samples/cpp/example_cmake$ ./opencv_example
14: Built with OpenCV 3.2.0
VIDEOIO ERROR: V4L: device nvcamerasrc ! video/x-raw(memory:NVMM), width=(int)1920, height=(int)1080,format=(string)I420, framerate=(fraction)30/1 ! nvvidconv flip-method=2 ! video/x-raw, format=(string)BGRx ! videoconvert ! video/x-raw, format=(string)BGR ! appsink: Unable to query number of channels
Available Sensor modes :
2592 x 1944 FR=30.000000 CF=0x1009208a10 SensorModeType=4 CSIPixelBitDepth=10 DynPixelBitDepth=10
2592 x 1458 FR=30.000000 CF=0x1009208a10 SensorModeType=4 CSIPixelBitDepth=10 DynPixelBitDepth=10
1280 x 720 FR=120.000000 CF=0x1009208a10 SensorModeType=4 CSIPixelBitDepth=10 DynPixelBitDepth=10
0:00:00.130728646 3139 0x6024a0 FIXME default gstutils.c:3766:gst_pad_create_stream_id_internal:nvcamerasrc0:src Creating random stream-id, consider implementing a deterministic way of creating a stream-id
NvCameraSrc: Trying To Set Default Camera Resolution. Selected 1920x1080 FrameRate = 30.000000 …
21: Capture is opened
init done
opengl support available