每次我编译这段代码时,网络摄像头流都会被镜像,就像我举起右手一样,看起来好像是我的左手在屏幕上,经过几次重新编译后,出现了一条错误消息和代码再也没有工作过。
错误: Camera.exe 中 0x00007FFB3C6DA1C8 处的未处理异常:Microsoft C++ 异常:内存位置 0x000000D18AD5F610 处的 cv::Exception。
除了中断进程之外别无选择。
代码:
#include <opencv2/highgui/highgui.hpp>
#include <opencv\cv.h>
using namespace cv;
int main(){
Mat image;
VideoCapture cap;
cap.open(1);
namedWindow("Window", 1);
while (1){
cap >> image;
imshow("window", image);
waitKey(33);
}
}
不知道是不是我的代码有问题我刚开始学习opencv!
最佳答案
#include <opencv2/highgui/highgui.hpp>
#include <opencv\cv.h>
using namespace cv;
int main(){
Mat image;
VideoCapture cap;
cap.open(1);
namedWindow("Window", 1);
while (1){
cap >> image;
flip(image,image,1)
imshow("window", image);
waitKey(33);
}
}
只需水平翻转图像即可Find More Here
关于c++ - 使用 OpenCV 3.0 + Visual Studio 2013 镜像网络摄像头流,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/31932511/