opencv 如何弹出cmos设置界面

平台windows:

添加代码 capture.set(CV_CAP_PROP_SETTINGS, 1)  即可

#include <opencv2/opencv.hpp>
#include <iostream>

using namespace std;
using namespace cv;


void main()
{
	Mat img;
	VideoCapture capture;



	capture.open(0);
	if (!capture.isOpened())
	{
		cout << "Can not open the camera 0!" << endl;
		cv::waitKey(0);
		exit(0);
	}
	capture.set(CV_CAP_PROP_FRAME_WIDTH, 1000);
	capture.set(CV_CAP_PROP_FRAME_HEIGHT, 1000);
	capture.set(CV_CAP_PROP_SETTINGS, 1);
	while (1)
	{
		capture >> img;
		//cout <<"W:" <<img.rows << "H:" << img.cols << endl;
		imshow("video test", img);
		if (waitKey(30) == 'q')
		{
			return;
		}
	}

	

	capture.release();
	//system("pause");
}

界面:

猜你喜欢

转载自blog.csdn.net/oMoDao1/article/details/82767572
今日推荐