【问题标题】:OpenCV - in OSX is failing to capture the cameraOpenCV - 在 OSX 中无法捕获相机
【发布时间】:2017-05-17 21:19:25
【问题描述】:

为什么在 OSX 中我的代码根本没有显示任何相机捕捉?

#include <opencv2/highgui/highgui.hpp>
#include <opencv2/imgproc/imgproc.hpp>
#include <iostream>
using namespace cv;
using namespace std;

int main() {
  VideoCapture stream1(0);   //0 or 1 or 2 same..

  if (!stream1.isOpened()) {
    cout << "cannot open camera";
  }


  while (true) {
    Mat cameraFrame;
    stream1.read(cameraFrame);
    imshow("cam", cameraFrame);
    if (waitKey(30) >= 0)
      break;
  }
  return 0;
}

【问题讨论】:

    标签: c++ macos opencv camera


    【解决方案1】:

    [已解决]问题已通过替换值解决

    VideoCapture stream1(2);

    【讨论】:

      猜你喜欢
      • 2018-01-04
      • 1970-01-01
      • 2016-02-01
      • 1970-01-01
      • 2015-02-14
      • 2014-01-22
      • 2017-04-14
      • 2018-02-13
      • 1970-01-01
      相关资源
      最近更新 更多