jetson Tx1 onboard camera ov5693 unable to access using opencv

Hello,
I am currently using a Jetson Tx1 R23.2 board, and am facing serious issues in accessing onboard camera ob5693 using opencv v2.4.11.

Based on posts in the forum (https://devtalk.nvidia.com/default/topic/925923/can-not-open-the-camera-on-tx1-via-opencv/), I tried using all the pipelines mentioned to access gstreamer from the blog for opencv, but am unable to get a video feed from the camera.I also tried using the same code as mentioned by some developers for whom it did work fine, but still did not work.

We also tried to use gstreamer pipelines as mentioned in this site ( Jetson TX1 GStreamer Pipelines | Jetson TX1 ARM Load) but in vain as the video feed just wont open with opencv. We didnot observe any compilation error in the program, but during execution, the video feed remains off.

But on the terminal the gstreamer runs perfectly with with the command nvgstcapture-1.0 -m 2 --video-res=5.

I also tried to patch the kernel as mentioned in this post(https://devtalk.nvidia.com/default/topic/920739/jetson-tx1/l4t-r23-2-for-jetson-tx1-released/1), to make the camera appear as a /dev/video node, however the approach wasnt useful as it bypasses the onboard camera’s ISP and provides it as a raw bayer format.

I request you to kindly enlighten me on how to use the onboard cam using opencv, with a proper documentation or some kind of decent guidance through which i would be able to access it at the earliest.
Thank you.

Hello, shashankv:
Would you please try openCV 3.1.0? It seems that openCV version lower than 3 does not parse the GST pipeline correctly.

br
ChenJian

Hi, it does work on OpenCV 3.1.0!

This was my code,

#include "opencv2/core/core.hpp"
#include "opencv2/highgui/highgui.hpp"
#include "opencv2/videoio.hpp"
using namespace cv;

int main(int, char **)
{

        VideoCapture cap("nvcamerasrc ! video/x-raw(memory:NVMM), width=(int)1280, height=(int)720, format=(string)I420, framerate=(fraction)30/1 ! nvvidconv flip-method=2 ! video/x-raw, format=(string)BGRx ! videoconvert ! appsink");

	namedWindow("Frames",CV_WINDOW_AUTOSIZE);

	if(!cap.isOpened())
	{
		return -1;
	}
	
	Mat frame;

	while(1)
	{
		cap >> frame;
		imshow("Frames", frame);
		waitKey(1);
	}
	
	return 0;
}

Compile and run,

g++ cam_test.cpp -o cam -lopencv_core -lopencv_highgui -lopencv_videoio
./cam

I’m running L4T 23.2 on the TX1.