Onboard camera

I can run most of the image processing programs on jetson.
However video capture file does not run.
I cannot get video from on board camera. Even cap(-1) does not work. Below is the code.
If you can help I appreciate

#include “opencv2/opencv.hpp”
using namespace cv;

int main(int, char**)
VideoCapture cap(0); // open the default camera
if(!cap.isOpened()) // check if we succeeded
return -1;
// namedWindow(“Bright”,1);
Mat frame;
cap >> frame; // get a new frame from camera
imshow(“Video”, frame);
// Mat imgH = frame + Scalar(50, 50, 50);
// imshow(“Bright”, imgH);
// Press ‘c’ to escape
if(waitKey(30) == ‘c’) break;
return 0;

The onboard camera is a bayer sensor, so I don’t think you can use it this way.
AFAIK, for using it in opencv, you have to convert it into a suitable format such as RGB.
This can be done by gstreamer, but unfortunately I don’t think that opencv4tegra has gstreamer support.

So, I would advice to compile your own version of opencv enabling gstreamer-1.0 support and install it. Then you should be able to run a gstreamer pipeline with opencv to your application. You may read this for a basic example doing this: https://devtalk.nvidia.com/default/topic/1001696/jetson-tx1/failed-to-open-tx1-on-board-camera/post/5117370/#5117370.

Thanks much . works very fine

This means even though Jetson comes with OpenCV from JetPack3.2 it cant read its own onboard cam?!

I try to run Yolo with darknet on my Jetson Tx2 (Flashed with Jetpack3.2) but it cant read the video signal of the onboard cam. only usb-webcams work.

Has anybody a solution?

Please create new topic to avoid confuse by the title.