Jetson TX1板载相机opencv调用打开

Jetson TX1 打开板载相机方式。

相关链接1:https://devtalk.nvidia.com/default/topic/987537/jetson-tx1/videocapture-fails-to-open-onboard-camera-l4t-24-2-1-opencv-3-1/

点击打开链接

相关链接2:http://elinux.org/Jetson_TX1

    #include <stdio.h>
    #include <opencv2/opencv.hpp>

    using namespace cv;
    using namespace std;

    int main(int argc, char** argv)
    {
      VideoCapture cap("nvcamerasrc ! video/x-raw(memory:NVMM), width=(int)1280, height=(int)720,format=(string)I420, framerate=(fraction)24/1 ! nvvidconv flip-method=2 ! video/x-raw, format=(string)BGRx ! videoconvert ! video/x-raw, format=(string)BGR ! appsink");
      //VideoCapture cap("fakesrc ! videoconvert ! appsink");
      if (!cap.isOpened())
        {
          cout << "Failed to open camera." << endl;
          return -1;
        }

      for(;;)
        {
          Mat frame;
          cap >> frame;
          imshow("original", frame);
          //waitKey(1);
          if(waitKey(30) >= 0)
          break;
        }
      return 0;
      //cap.release();
    }

你可能感兴趣的:(Jetson,TX1)