设计色彩网站,秀山县公共资源交易中心,网站开发的经济效益分析,布局网站建设Opencv驱动摄像头#xff0c;此段代码只能驱动电脑自带摄像头#xff0c;目前没有分析出为何不能驱动另外连接的相机#xff01;
#includeiostream
#includeopencv2\core.hpp
#includeopencv2\highgui.hpp
#includeopencv2\imgproc.hpp
#i…Opencv驱动摄像头此段代码只能驱动电脑自带摄像头目前没有分析出为何不能驱动另外连接的相机
#includeiostream
#includeopencv2\core.hpp
#includeopencv2\highgui.hpp
#includeopencv2\imgproc.hpp
#includeopencv2\imgcodecs.hpp
using namespace cv;
using namespace std;//显示图像
int main(int argc, char **argv)
{窗口名称//string windowName helloworld;图像名称//string imgFile D:/220502.jpg;读入图像//Mat image cv::imread(imgFile);//if (!image.data)//{// cout 无法打开图像文件! std::endl;// waitKey(0);// return -1;//}创建一个新窗口//namedWindow(windowName, WINDOW_AUTOSIZE);将图像显示在新建的窗口中//imshow(windowName, image);等待直到用户按任意键退出VideoCapture video(0);//VideoCapture video(rtsp://192.168.1.10/1);if (!video.isOpened()){cout 打开失败 endl;system(pause);return 0;}while (1){Mat frame;video frame;if (frame.empty()){break;}imshow(video, frame);waitKey();}waitKey(0);return 0;}