Marcos.Scholl wrote:Hello waveform80.
This is outside the resolution of the screen RaspbianOS . I need the preview , stay within a frame that had its adjustable size. This is possible ?
This isn't (directly) possible with the camera's preview system. The preview doesn't appear within a frame in the GUI. For that matter, it has nothing to do with the GUI at all - you can run the preview from the command line environment before you ever start X-windows. In fact you can even start the preview when logged in remotely over SSH before a framebuffer is available!
What's actually going on (as I understand it, and I should stress I'm not the expert on this - that'd be jamesh) is that starting the preview causes the GPU to simply render the preview over whatever is on the screen. To the best of my knowledge there's no way to get the preview to sit within a window or frame in X-windows because the preview system doesn't even know X-windows is there.
Now, having said that, there are some things you can do to "fake it"...
Marcos.Scholl wrote:What adjustments should I do to get a good view , something around 20 fps in 720p resolution and within a frame of a 740x620 .
The picamera library (and the mmal library it's based upon) does provide ways to reposition and resize the area of the screen that the preview overlays. In the case of picamera, set the preview_fullscreen
property to False, and then the preview_window
property to the (x, y, width, height) that you wish to preview to cover. Those coordinates are in screen coordinates for the Pi, so if you're running at 1080p and you want the preview to be 740x620 in the middle of the screen, you'd do something like:
Code: Select all
camera.preview_fullscreen = False
camera.preview_window = (1920/2-740/2, 1080/2-620/2, 740, 620)
Obviously that's not exactly what you're asking for - i.e. it's not within an X-windows frame, but you could position an X-windows frame "around" the area set for the preview (hence why I say this is "faking it"). You can also adjust things like the preview opacity if you want to display things "behind" the preview.
I should also note in future releases, it *may* be possible to render things on top of the preview via OpenGL/ES - this is something I'm looking into, but at the moment only raspistill/raspivid offer these capabilities.
Author of / contributor to a few pi related things (picamera, Sense HAT emulator, gpio-zero, piwheels, etc.), and currently a software engineer at Canonical responsible for Ubuntu Server and Core on the Raspberry Pi.