-
Notifications
You must be signed in to change notification settings - Fork 162
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Make q_picamera2 and q_gl_picamera2 dynamic size #62
Comments
Hi, thank you for sending this. Would you be able to turn this into a pull request, that way it gets some automated testing and it's convenient for folks to pull your branch if they want to try it. Thanks! (I'm away for a few days but will get back to it after that.) |
Hi, I'll have a go at doing a pull request today. |
While reimplementing my app and learning a little more about PyQt5, it occurred to me it that QPicamera2 might be better implemented as a QGraphicsView object. The preview image stored as a pixmap in the scene. Qt then handles all the view scaling automatically. Will experiment and report back... |
Looks like this is fixed now. :) |
I think the camera preview in the q_picamera2 and q_gl_picamera2 should be made (optionally) to automatically fill the size of its container. This problem can be seen in examples/app_capture.py - resizing or maximising the window doesn't look very good. The preview in many application cases I'd expect will need to fit the maximum space available.
My project is a cine film scanner using the HQ camera. It's original control UI was written using picamera and tkinter which sort of worked, but very clunky. I decided to start again using picamera2 and PyQt5, so I'm fumbling to implement a new GUI.
The q_picamera2 and q_gl_picamera2 widget looks ideal for showing a live view for focussing and aligning the camera, and indeed I'm starting by building on app_capture.py for a live preview and basic camera settings.
I altered q_picamera2.py to implement a dynamic resize which seems to work - patch below. It implements a resize event, decouples the camera image size from the label size, centres the camera image in the label. A layout control fills the label to the size of the parent widget. The overlay is handled and resized as necessary. It can be tested in examples/app_capture.py by replacing the
q_glpicamera2.py
import toq_picamera2
and theqpicamera2
declaration toqpicamera2 = QPicamera2(picam2,resizeable=True)
I'm sure it can be optimised. Similar functionality should exist on the GL preview widget but I got lost trying to understand the GL code. Just getting up to speed with basic PyQt at the moment.
The text was updated successfully, but these errors were encountered: