Manual exposure support for OpenCV
This commit is contained in:
parent
983ddb83ba
commit
0c4992ffaf
3 changed files with 27 additions and 0 deletions
|
|
@ -37,6 +37,17 @@ if fw != -1:
|
|||
if fh != -1:
|
||||
video_capture.set(cv2.CAP_PROP_FRAME_HEIGHT, fh)
|
||||
|
||||
# Disable autoexposure
|
||||
exposure = config.getint("video", "exposure", fallback=-1)
|
||||
if exposure != -1:
|
||||
# For a strange reason on some cameras (e.g. Lenoxo X1E)
|
||||
# setting manual exposure works only after a couple frames
|
||||
# are captured.
|
||||
for i in range(6):
|
||||
video_capture.grab()
|
||||
video_capture.set(cv2.CAP_PROP_AUTO_EXPOSURE, 1.0) # 1 = Manual
|
||||
video_capture.set(cv2.CAP_PROP_EXPOSURE, 167.0)
|
||||
|
||||
# Let the user know what's up
|
||||
print("""
|
||||
Opening a window with a test feed
|
||||
|
|
|
|||
|
|
@ -144,6 +144,17 @@ if fh != -1:
|
|||
# This will let the camera adjust its light levels while we're importing for faster scanning
|
||||
video_capture.grab()
|
||||
|
||||
# Disable autoexposure
|
||||
exposure = config.getint("video", "exposure", fallback=-1)
|
||||
if exposure != -1:
|
||||
# For a strange reason on some cameras (e.g. Lenoxo X1E)
|
||||
# setting manual exposure works only after a couple frames
|
||||
# are captured.
|
||||
for i in range(5):
|
||||
video_capture.grab()
|
||||
video_capture.set(cv2.CAP_PROP_AUTO_EXPOSURE, 1.0) # 1 = Manual
|
||||
video_capture.set(cv2.CAP_PROP_EXPOSURE, 167.0)
|
||||
|
||||
# Note the time it took to open the camera
|
||||
timings["ic"] = time.time() - timings["ic"]
|
||||
|
||||
|
|
|
|||
|
|
@ -70,6 +70,11 @@ device_format = v4l2
|
|||
# OPENCV only.
|
||||
force_mjpeg = false
|
||||
|
||||
# Specify exposure value explicitly. This disables autoexposure.
|
||||
# Use qv4l2 to determine an appropriate value.
|
||||
# OPENCV only.
|
||||
exposure = -1
|
||||
|
||||
[debug]
|
||||
# Show a short but detailed diagnostic report in console
|
||||
end_report = false
|
||||
|
|
|
|||
Loading…
Reference in a new issue