Update image_nodes.py

Trying to set capture size for cameras that support multiple resolutions. Might be better to use two separate values for that or query the camera's native resolutions, but for now that's what I needed.
This commit is contained in:
Mario Klingemann 2024-07-26 22:15:53 +02:00 committed by GitHub
parent 6e3af6e7b9
commit 5568cff68a
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194

View File

@ -496,6 +496,11 @@ Can be used for realtime diffusion with autoqueue.
self.cap.release()
self.current_cam_index = cam_index
self.cap = cv2.VideoCapture(cam_index)
try:
self.cap.set(cv2.CAP_PROP_FRAME_WIDTH, width)
self.cap.set(cv2.CAP_PROP_FRAME_HEIGHT, height)
except:
pass
if not self.cap.isOpened():
raise Exception("Could not open webcam")
@ -1663,4 +1668,4 @@ class LoadAndResizeImage:
if not folder_paths.exists_annotated_filepath(image):
return "Invalid image file: {}".format(image)
return True
return True