Hello,
I’m trying to just open a CSI camera in opencv3.3.
As I can’t manage to get anything I tried from shell with:
gst-launch-1.0 nvcamerasrc fpsRange="30.0 30.0" ! 'video/x-raw(memory:NVMM), width=(int)1920, height=(int)1080, format=(string)I420, framerate=(fraction)30/1' ! nvtee ! nvvidconv flip-method=2 ! 'video/x-raw(memory:NVMM), format=(string)I420' ! nvoverlaysink -e
This gave me an image.
I tried to open with:
std::string gst = "nvcamerasrc ! video/x-raw(memory:NVMM), width=(int)1920, height=(int)1080, format=(string)I420, framerate=(fraction)30/1 ! nvvidconv flip-method=0 ! video/x-raw, format=(string)BGRx ! videoconvert ! video/x-raw, format=(string)BGR ! appsink ";
cv::VideoCapture cap(gst);
I also tried:
std::string gst = "nvcamerasrc ! video/x-raw(memory:NVMM), width=(int)1920, height=(int)1080, format=(string)I420, framerate=(fraction)30/1 ! nvvidconv flip-method=0 ! video/x-raw, format=(string)BGRx ! videoconvert ! video/x-raw, format=(string)BGR ! appsink ";
cv::VideoCapture cap(gst, CV_CAP_GSTREAMER);
All those fail to open the device.
If I do:
(./test_camera)
cv::VideoCapture cap(0);
This does open the capture but just give me a black frame…
But if I do :
sudo ./test_camera //code is cv::VideoCapture cap(0);
I get :
VIDEOIO ERROR: V4L2:Pixel format of incoming image is unsupported by OpenCV
Unable to stop the stream: Invalid argument
Which is normal as I’m not supposed to be able to open a canera with 0 (or 1) in opencv on my TX1 .
I’m currently out of idea after a day trying nearly everything I can find, if anyone have any idea.
(Note: the camera is a Leopard camera )
(Note2: I can nearly remove all parameters of the command line & still be able to get the camera output on the terminal)