1

我在 OpenCV 4.0.1 中手动设置相机曝光时遇到了一些问题。我正在使用 Raspberry Pi 3 B+ 作为带有 Raspbian Stretch OS 和 Python 3.x 的计算机。当我有旧版本的 OpenCV 3.xx 时,Exposure 的手动设置与此代码完美配合:

“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 的经验吗?

谢谢您的回答...

4

2 回答 2

1

谢谢大家帮助我。我在设置参数中尝试了“-4”,但它不起作用。

唯一对我有用的是:

# Manual / Auto exposure mode
if exposureMode == 1:
    command = "v4l2-ctl -d /dev/video0 -c exposure_auto=1 -c exposure_absolute=" + str(exposureTime)
    output = subprocess.call(command, shell=True)
else:
    command = "v4l2-ctl -d /dev/video0 -c exposure_auto=3"
    output = subprocess.call(command, shell=True)

祝你今天过得愉快 :)

于 2019-11-21T08:38:42.150 回答
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 = 80 ms)
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()
于 2019-11-20T03:20:22.223 回答