Jetson Tx2 onboard camera with opencv3.3.1

Hi, my jetson tx2 has opencv3.3.1. I compiled the jetpack3.2 and i want to use its onboard camera.
When i use any of these commands-

  1. cv::VideoCapture cap(“nvcamerasrc ! ‘video/x-raw(memory:NVMM), width=640, height=480, framerate=30/1, format=NV12’ ! nvvidconv flip-method=2 ! nvegltransform ! nveglglessink -e”);

  2. cap = cv2.VideoCapture(“nvcamerasrc ! video/x-raw(memory:NVMM), width=(int)1280, height=(int)720, format=(string)I420, framerate=(fraction)24/1 !
    nvvidconv flip-method=6 ! video/x-raw, format=(string)I420 !
    videoconvert ! video/x-raw, format=(string)BGR !

It show failed to open camera. I have read many of the post regarding the same but didn’t get the satisfatory result. How can i start camera with opencv?

The opencv-3.3.1 version included in JetPack doesn’t have gstreamer support.
You would have to build and install your own version enabling gstreamer-1.0 support.