如何在 OpenCV 和 Python 中将 V4L2 曝光设置为手动模式
在 Linux 上使用 OpenCV,如果你有连接 V4L2 设备(如 USB 摄像头)的视频设备:
v4l2_capture_example.py
camera = cv2.VideoCapture(0)你通常可以通过将 exposure_auto 设置为 1 来设置自动曝光模式(以下输出来自 v4l2-ctl -d /dev/video0 --all):
v4l2_exposure_auto_output.txt
exposure_auto 0x009a0901 (menu) : min=0 max=3 default=3 value=1
1: Manual Mode
3: Aperture Priority Mode正如你在我们之前的博客文章中所见,exposure_auto(在 C/C++ 的 V4L2 中名为 V4L2_CID_EXPOSURE_AUTO)映射到 CAP_PROP_AUTO_EXPOSURE。
因此,你可以使用以下命令启用手动曝光
v4l2_set_manual_exposure.py
camera.set(cv2.CAP_PROP_AUTO_EXPOSURE, 1) # 将曝光设置为手动模式但是,你应该使用你的特定摄像头通过 v4l2-ctl --all 验证这些设置。
If this post helped you, please consider buying me a coffee or donating via PayPal to support research & publishing of new posts on TechOverflow