首页 > 解决方案 > 如何使用 opencv 的 VideoCapture 连接 Gopro cam?

问题描述

Visual Studio 和 opencv 使用的是 2019 和 4.4.0 版本

GoPRO HERO 7 BLACK 使用 USB-C 连接到 PC。

我尝试使用 VideoCapture() 打开摄像头,但它没有打开。

下面是正在使用的代码。

#include <opencv2\opencv.hpp>
#include <opencv2\highgui.hpp>
#include <opencv2\core.hpp>
#include <opencv2\imgproc.h>>
using namespace cv;
using namespace std;

int main(void) {
   VideoCpature webcam_01(0);
   if(!webcam_01.isOpened()) {
      cout << "Cam opened error" << endl;
      return -1; }

   while(1) {
      Mat frame;
      webcam_01.read(frame);
      if(frame.empty()) {
        cout << "frame empty" << endl;
        break;
      }
      imshow("img", frame);
  }
  return 0;
}

标签: c++opencv

解决方案


推荐阅读