Update codes following the comments of @sourcery-ai.

Signed-off-by: Vic P <vic4key@gmail.com>
This commit is contained in:
Vic P 2024-08-22 00:50:14 +07:00
parent 4f62119c2e
commit 3755198ecd

View File

@ -290,12 +290,10 @@ def webcam_preview():
global preview_label, PREVIEW
camera = cv2.VideoCapture(0) # Use index for the webcam (adjust the index accordingly if necessary)
camera.set(cv2.CAP_PROP_FRAME_WIDTH, 960) # Set the width of the resolution
camera.set(cv2.CAP_PROP_FRAME_HEIGHT, 540) # Set the height of the resolution
camera.set(cv2.CAP_PROP_FPS, 60) # Set the frame rate of the webcam
PREVIEW_MAX_WIDTH = 960
PREVIEW_MAX_HEIGHT = 540
camera = cv2.VideoCapture(0) # Use index for the webcam (adjust the index accordingly if necessary)
camera.set(cv2.CAP_PROP_FRAME_WIDTH, PREVIEW_DEFAULT_WIDTH) # Set the width of the resolution
camera.set(cv2.CAP_PROP_FRAME_HEIGHT, PREVIEW_DEFAULT_HEIGHT) # Set the height of the resolution
camera.set(cv2.CAP_PROP_FPS, 60) # Set the frame rate of the webcam
preview_label.configure(width=PREVIEW_DEFAULT_WIDTH, height=PREVIEW_DEFAULT_HEIGHT) # Reset the preview image before startup