《OpenCV設定和獲取攝像頭引數》

歐陽磊發表於2017-12-22

適用於VideoCapture開啟的攝像頭

VideoCapture capture(0);

 

設定攝像頭引數 不要隨意修改


capture.set(CV_CAP_PROP_FRAME_WIDTH, 1080);//寬度 
capture.set(CV_CAP_PROP_FRAME_HEIGHT, 960);//高度
capture.set(CV_CAP_PROP_FPS, 30);//幀率 幀/秒
capture.set(CV_CAP_PROP_BRIGHTNESS, 1);//亮度 1
capture.set(CV_CAP_PROP_CONTRAST,40);//對比度 40
capture.set(CV_CAP_PROP_SATURATION, 50);//飽和度 50
capture.set(CV_CAP_PROP_HUE, 50);//色調 50
capture.set(CV_CAP_PROP_EXPOSURE, 50);//曝光 50

獲取攝像頭引數


capture.get(CV_CAP_PROP_FRAME_WIDTH);
capture.get(CV_CAP_PROP_FRAME_HEIGHT);
capture.get(CV_CAP_PROP_FPS);
capture.get(CV_CAP_PROP_BRIGHTNESS);
capture.get(CV_CAP_PROP_CONTRAST);
capture.get(CV_CAP_PROP_SATURATION);
capture.get(CV_CAP_PROP_HUE);
capture.get(CV_CAP_PROP_EXPOSURE);

 

獲取視訊引數


capture.get(CV_CAP_PROP_FRAME_COUNT);//視訊幀數

相關文章