Great stuff, it did work.
If you don't mind explaining what exactly this is doing?
From what I see, we call the picamera on a different GUI kit "QtGlPreview", then from that preview we can actually get the frame data and use cv2 with it.
I would like to try to find a way to not display the preview, but it doesn't seem like that is how this works.
But I can still do all the cv2 calculations with the frame it looks like, just can't display it unless I use cv2.imshow which then I have 2 display windows.
Thank you for the quick response.
Here is my code for reference:
If you don't mind explaining what exactly this is doing?
From what I see, we call the picamera on a different GUI kit "QtGlPreview", then from that preview we can actually get the frame data and use cv2 with it.
I would like to try to find a way to not display the preview, but it doesn't seem like that is how this works.
But I can still do all the cv2 calculations with the frame it looks like, just can't display it unless I use cv2.imshow which then I have 2 display windows.
Thank you for the quick response.
Here is my code for reference:
Code:
import cv2import timefrom picamera2 import Picamera2, MappedArraydef setupCam(): cam = Picamera2() def preview(request): with MappedArray(request, "main") as m: pass cam.pre_callback = preview time.sleep(5) cam.start(show_preview=True) return camdef test(cam): frame = cam.capture_array() height, width, _ = frame.shape middle = (int(width / 2), int(height / 2)) while True: frame = cam.capture_array() cv2.circle(frame, middle, 10, (255, 0 , 255), -1) cv2.imshow('f', frame)test(setupCam())
Statistics: Posted by YesseG7 — Tue Apr 23, 2024 8:43 pm