From 67c8435558f3921d8e7d42705d52cf23a731d234 Mon Sep 17 00:00:00 2001 From: Kieran Easdale Date: Fri, 23 Aug 2024 10:17:42 +0100 Subject: [PATCH] Created cameraTest.py to check camera feed externally to project --- computer_code/cameraTest.py | 23 +++++++++++++++++++++++ 1 file changed, 23 insertions(+) create mode 100644 computer_code/cameraTest.py diff --git a/computer_code/cameraTest.py b/computer_code/cameraTest.py new file mode 100644 index 0000000..925b933 --- /dev/null +++ b/computer_code/cameraTest.py @@ -0,0 +1,23 @@ +from pseyepy import Camera +import cv2 as cv + +# Initialize all connected cameras +c = Camera() + +# Continuously capture and display frames +while True: + # Read from the cameras + frames, timestamp = c.read() + + # Display each frame in a separate window + for i, frame in enumerate(frames): + window_name = f'Camera {i + 1} Frame' + cv.imshow(window_name, frame) + + # Wait for a short period, check for key press + if cv.waitKey(1) & 0xFF == ord('q'): + break + +# When finished, close the camera and destroy the windows +c.end() +cv.destroyAllWindows()