我有这段代码,它使用 OpenCV 从网络摄像头捕获图像:
#include <opencv2/objdetect/objdetect.hpp>
#include <opencv2/highgui/highgui.hpp>
#include <opencv2/imgproc/imgproc.hpp>
#include <iostream>
#include <stdio.h>
using namespace std;
using namespace cv;
int main( )
{
VideoCapture cap(0); // open the default camera
if(!cap.isOpened()) // check if we succeeded
return -1;
Mat meter_image;
cap >> meter_image;
imwrite("/boneCV-master/img.jpg", meter_image);
return 0;
}
我得到以下图像作为输出。
以前它工作正常。我不知道发生了什么。我在谷歌搜索时尝试了所有代码中最简单的,但没有任何效果。请让我知道它可能有什么问题。
提前致谢。
编辑
我忘记提到的一件事是我正在研究 beagleBone Black。这段代码在我的 mac 上效果很好。