Added config option to set height and width of frame from #40
This commit is contained in:
parent
38eff8149d
commit
5751650af3
3 changed files with 22 additions and 1 deletions
|
|
@ -24,6 +24,13 @@ video_capture = cv2.VideoCapture(int(config.get("video", "device_id")))
|
|||
if config.get("video", "force_mjpeg") == "true":
|
||||
video_capture.set(cv2.CAP_PROP_FOURCC, 1196444237)
|
||||
|
||||
# Set the frame width and height if requested
|
||||
if int(config.get("video", "frame_width")) != -1:
|
||||
video_capture.set(cv2.CAP_PROP_FRAME_WIDTH, int(config.get("video", "frame_width")))
|
||||
|
||||
if int(config.get("video", "frame_height")) != -1:
|
||||
video_capture.set(cv2.CAP_PROP_FRAME_HEIGHT, int(config.get("video", "frame_height")))
|
||||
|
||||
# Let the user know what's up
|
||||
print("""
|
||||
Opening a window with a test feed
|
||||
|
|
|
|||
|
|
@ -62,8 +62,16 @@ video_capture = cv2.VideoCapture(int(config.get("video", "device_id")))
|
|||
|
||||
# Force MJPEG decoding if true
|
||||
if config.get("video", "force_mjpeg") == "true":
|
||||
# Set a magic number, will enable MJPEG but is badly documentated
|
||||
video_capture.set(cv2.CAP_PROP_FOURCC, 1196444237)
|
||||
|
||||
# Set the frame width and height if requested
|
||||
if int(config.get("video", "frame_width")) != -1:
|
||||
video_capture.set(cv2.CAP_PROP_FRAME_WIDTH, int(config.get("video", "frame_width")))
|
||||
|
||||
if int(config.get("video", "frame_height")) != -1:
|
||||
video_capture.set(cv2.CAP_PROP_FRAME_HEIGHT, int(config.get("video", "frame_height")))
|
||||
|
||||
# Capture a single frame so the camera becomes active
|
||||
# This will let the camera adjust its light levels while we're importing for faster scanning
|
||||
video_capture.read()
|
||||
|
|
@ -164,5 +172,5 @@ while True:
|
|||
|
||||
print("Winning model: " + str(match_index) + " (\"" + models[match_index]["label"] + "\")")
|
||||
|
||||
# End peacegully
|
||||
# End peacefully
|
||||
stop(0)
|
||||
|
|
|
|||
|
|
@ -38,6 +38,12 @@ max_height = 320
|
|||
# YUYV raw frame deconding
|
||||
force_mjpeg = false
|
||||
|
||||
# Set the camera input profile to this width and height
|
||||
# The largest profile will be used if set to -1
|
||||
# Automatically ignored if not a valid profile
|
||||
frame_width = -1
|
||||
frame_height = -1
|
||||
|
||||
# Because of flashing IR emitters, some frames can be completely unlit
|
||||
# Skip the frame if the lowest 1/8 of the histogram is above this percentage
|
||||
# of the total
|
||||
|
|
|
|||
Loading…
Reference in a new issue