So I am trying to pyQT and then picamera2 API to develop a GUI to control the HQ camera. I am following the documentation and confirmed the basic test works and the camera does take an image with a preview shown for “x” seconds.
from picamera2 import Picamera2, Preview
import time
picam2 = Picamera2()
camera_config = picam2.create_preview_configuration()
picam2.configure(camera_config)
picam2.start_preview(Preview.QTGL)
picam2.start()
time.sleep(2)
picam2.capture_file("test.jpg")
However when I try to run the example preview code it just shows a black screen on the preview for half a second and then juts quits out.
from picamera2 import Picamera2, Preview
from libcamera import Transform
picam2 = Picamera2()
picam2.start_preview(Preview.QTGL, x=100, y=200, width=800, height=600,
transform=Transform(hflip=1))
picam2.start()
How do I make it show a preview indefinitely and not have the black screen it shows? Thank you