阅读背景:

7、TX2学习笔记--Jetson TX2板载相机opencv调用打开

来源:互联网 

一、打开板载相机的效果图



二、代码

1、OpenCV代码如下

//
#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");  
  if (!cap.isOpened())  
    {  
      cout << "Failed to open camera." << endl;  
      return -1;  
    }  
  
  for(;;)  
    {  
      Mat frame;  
      cap >> frame;  
      imshow("original", frame);  
      if(waitKey(30) >= 0)  
      break;  
    }  
  return 0;  
}  
///



你的当前访问异常,请进行认证后继续阅读剩余内容。

分享到: