opencv ,打开摄像头
2017-01-04 16:13
232 查看
// videocap.cpp : 定义控制台应用程序的入口点。 // #include "stdafx.h" #include <stdio.h> #include <iostream> #include "opencv2/core/core.hpp" #include "opencv2/highgui/highgui.hpp" #include "opencv2/imgproc/imgproc.hpp" #ifdef _DEBUG #pragma comment(lib, "lib/opencv_core2411d") #pragma comment(lib,"lib/opencv_highgui2411d") #pragma comment(lib, "lib/opencv_imgproc2411d") #else #pragma comment(lib, "lib/opencv_core2411") #pragma comment(lib, "lib/opencv_highgui2411") #pragma comment(lib, "lib/opencv_imgproc2411") #endif using namespace cv; using namespace std; int _tmain(int argc, _TCHAR* argv[]) { //VideoCapture capture("Video 1.mp4");//读入视频文件 VideoCapture capture(0);//从摄像头读入图像 VideoCapture capture1(1);//从摄像头读入图像 VideoCapture capture2(2);//从摄像头读入图像 //waitKey(4000); double width = capture.get(CV_CAP_PROP_FRAME_WIDTH); double height = capture.get(CV_CAP_PROP_FRAME_HEIGHT); /*capture.set(CV_CAP_PROP_FRAME_WIDTH, 1920); capture.set(CV_CAP_PROP_FRAME_HEIGHT, 1080); capture1.set(CV_CAP_PROP_FRAME_WIDTH, 1920); capture1.set(CV_CAP_PROP_FRAME_HEIGHT, 1080);*/ //if (!capture.isOpened())//函数用来检验是否打开成功 //{ // cout << "fail to open!" << endl; // return -1; //} while (1) { Mat frame,frame1,frame2; if (capture.isOpened()) { //double t1 = (double)getTickCount(); capture >> frame; //t1 = ((double)getTickCount() - t1) / getTickFrequency(); //imwrite("图片\\" + to_string(i) + ".jpg", frame); namedWindow("0"); imshow("0", frame); } if (capture1.isOpened()) { capture1 >> frame1; namedWindow("1", 1); imshow("1", frame1); } if (capture2.isOpened()) { capture2 >> frame2; namedWindow("2", 1); imshow("2", frame2); } waitKey(33); } //system("pause"); return 0;
相关文章推荐
- 使用PCI-E USB3.0扩展板卡解决OPENCV不能同时打开同品牌摄像头的问题
- MFC 通过opencv打开摄像头 拍照后显示保存
- Linux下OpenCV打开USB接口的UVC摄像头的方法以及索引号为什么要是202的原因
- opencv打开摄像头获取视频程序
- 11、新手入手树莓派教程--Qt中使用wiringPi来驱动RGB灯、使用opencv打开摄像头
- OpenCV打开摄像头出现运行错误OpenCV Error:Assertion failed (size.width>0&&size.height>0)in cv::imshow,……
- 【opencv3.0】打开摄像头
- opencv 打开摄像头并将视频数据写入文件
- OpenCV x64 vs2010 下打开摄像头录制视频写成avi(代码为转载)
- OpenCV打开摄像头并获取实时视频图像代码
- openCV打开树莓派原装CSI摄像头
- 在MFC中显示OpenCV的Mat格式图像和打开摄像头
- 12、新手入手树莓派教程--Qt中使用wiringPi来驱动RGB灯、使用opencv打开摄像头(代码分享)
- OpenCV Open Camera 打开摄像头
- OpenCV For Android - 打开摄像头时让画面摆正
- OPencv2 无法打开摄像,摄像头灰
- OpenCV学习笔记(四)VS+OpenCV 摄像头无法打开
- OpenCV2.2无法打开摄像头的解决办法
- opencv1.0用笔记本打开摄像头画面为黑色
- 通过OpenCV打开摄像头