第七色在线视频,2021少妇久久久久久久久久,亚洲欧洲精品成人久久av18,亚洲国产精品特色大片观看完整版,孙宇晨将参加特朗普的晚宴

為了賬號安全,請及時(shí)綁定郵箱和手機(jī)立即綁定
已解決430363個(gè)問題,去搜搜看,總會有你想問的

在OpenCV / Python中設(shè)置相機(jī)參數(shù)

在OpenCV / Python中設(shè)置相機(jī)參數(shù)

森林海 2019-10-25 10:38:16
我正在使用來自Thorlabs(DC1545M)的USB攝像機(jī)的OpenCV(2.4)和Python(2.7.3)。我正在對視頻流進(jìn)行一些圖像分析,我希望能夠從我的視頻流中更改某些相機(jī)參數(shù)。令人困惑的是,我可以更改某些相機(jī)屬性,但不能更改所有屬性,而且我不確定自己做錯(cuò)了什么。這是在Python中使用cv2綁定的代碼,我可以確認(rèn)它可以運(yùn)行:import cv2#capture from camera at location 0cap = cv2.VideoCapture(0)#set the width and height, and UNSUCCESSFULLY set the exposure timecap.set(3,1280)cap.set(4,1024)cap.set(15, 0.1)while True:    ret, img = cap.read()    cv2.imshow("input", img)    #cv2.imshow("thresholded", imgray*thresh2)    key = cv2.waitKey(10)    if key == 27:        breakcv2.destroyAllWindows() cv2.VideoCapture(0).release()作為參考,cap.set()命令中的第一個(gè)參數(shù)引用相機(jī)屬性的枚舉,如下所示:0. CV_CAP_PROP_POS_MSEC Current position of the video file in milliseconds.1. CV_CAP_PROP_POS_FRAMES 0-based index of the frame to be decoded/captured next.2. CV_CAP_PROP_POS_AVI_RATIO Relative position of the video file3. CV_CAP_PROP_FRAME_WIDTH Width of the frames in the video stream.4. CV_CAP_PROP_FRAME_HEIGHT Height of the frames in the video stream.5. CV_CAP_PROP_FPS Frame rate.6. CV_CAP_PROP_FOURCC 4-character code of codec.7. CV_CAP_PROP_FRAME_COUNT Number of frames in the video file.8. CV_CAP_PROP_FORMAT Format of the Mat objects returned by retrieve() .9. CV_CAP_PROP_MODE Backend-specific value indicating the current capture mode.10. CV_CAP_PROP_BRIGHTNESS Brightness of the image (only for cameras).11. CV_CAP_PROP_CONTRAST Contrast of the image (only for cameras).12. CV_CAP_PROP_SATURATION Saturation of the image (only for cameras).13. CV_CAP_PROP_HUE Hue of the image (only for cameras).14. CV_CAP_PROP_GAIN Gain of the image (only for cameras).15. CV_CAP_PROP_EXPOSURE Exposure (only for cameras).16. CV_CAP_PROP_CONVERT_RGB Boolean flags indicating whether images should be converted to RGB.17. CV_CAP_PROP_WHITE_BALANCE Currently unsupported我的問題是:是否可以通過python / opencv設(shè)置相機(jī)曝光時(shí)間(或其他相機(jī)參數(shù))?如果沒有,我將如何設(shè)置這些參數(shù)?注意:相機(jī)制造商提供了C ++代碼來顯示如何執(zhí)行此操作,但是我不是C ++的專家(長期來看),并且希望使用任何基于python的解決方案。提前致謝!
查看完整描述

3 回答

?
慕尼黑的夜晚無繁華

TA貢獻(xiàn)1864條經(jīng)驗(yàn) 獲得超6個(gè)贊

我在Raspberry Pi上使用openCV遇到了同樣的問題...不知道這是否可以解決您的問題,但是對我有用的是


import time

import cv2



cap = cv2.VideoCapture(0)


cap.set(3,1280)


cap.set(4,1024)


time.sleep(2)


cap.set(15, -8.0)

您必須使用的時(shí)間可能會有所不同


查看完整回答
反對 回復(fù) 2019-10-25
  • 3 回答
  • 0 關(guān)注
  • 1624 瀏覽
慕課專欄
更多

添加回答

舉報(bào)

0/150
提交
取消
微信客服

購課補(bǔ)貼
聯(lián)系客服咨詢優(yōu)惠詳情

幫助反饋 APP下載

慕課網(wǎng)APP
您的移動(dòng)學(xué)習(xí)伙伴

公眾號

掃描二維碼
關(guān)注慕課網(wǎng)微信公眾號