曝光模式OpenCV 4.0.1

问题描述 投票:1回答:1

我在OpenCV 4.0.1中手动设置相机曝光有麻烦。我将Raspberry Pi 3 B +用作具有Raspbian Stretch OS和Python 3.x的计算机。当我有旧版本的OpenCV 3.x.x时,使用以下代码可以完美地手动设置“曝光”:

“ camera.set(cv2.CAP_PROP_AUTO_EXPOSURE,0.25)”

“ camera.set(cv2.CAP_PROP_EXPOSURE,(float(exposureTime))”

但是现在当我使用OpenCV 4.0.1时,上面的代码不会更改任何内容,并且相机仍处于自动曝光模式。相机传感器与以前相同,它是ELP制造的Sony IMX322。您对OpenCV 4.0.1中的MANUAL EXPOSURE有任何经验吗?

谢谢您的回答...

python opencv camera raspberry-pi3 exposure
1个回答
0
投票

以下内容对我有用:

import cv2

#capture from camera at location 0
cap = cv2.VideoCapture(0)

# now set the camera exposure to -4 ( means 2^-4 = 1/16)
cap.set(15, -4)

while True:
    ret, img = cap.read()
    print(img.shape)
    cv2.imshow("input", img)

    key = cv2.waitKey(10)
    if key == 27: # Esc
        break

cv2.destroyAllWindows() 
cap.release()
© www.soinside.com 2019 - 2024. All rights reserved.