Quantcast
Channel: Raspberry Pi Forums
Viewing all articles
Browse latest Browse all 4792

Camera board • Direct Rendering with GUI in PiCamera2

$
0
0
Hello,

Current Test Setup:
Pi: Raspberry Pi 5
OS: Raspbian Bookworm Lite 64bit (Release date: July 4th 2024)
Camera Library: PiCamera2
Camera: Pi Camera v1.3 (after dtoverlay=ov5467 in /boot/firmware/config.txt and other changes)

Code Used (Working on this setup):

Code:

from picamera2 import Picamera2from picamera2.previews.qt import QGlPicamera2class VideoWidget:    def __init__(self):        self.camera = Picamera2()        config = self.cam.create_preview_configuration(            main={"size": (1920, 1080)}        )        self.camera.configure(config)        self.box = QGlPicamera2(self.camera)    def start_stream(self):        self.camera.start()    def stop_stream(self):        self.camera.stop()
Old Test Setup: (I did this in somewhere 2019 or 2020)
Pi: Raspberry Pi 3B+
OS: Raspbian Stretch/Buster Lite 32bit
Camera Library: PiCamera
Camera: Pi Camera v1.3

Code Used (Working on this setup):

Code:

import picameraclass VideoWidget:    def __init__(self, widget_pos=[0,0,1366,768]):        self.camera = picamera.PiCamera()    def start_stream(self):        self.camera.start_preview()        self.camera.preview.window = [960, 540, 960, 540]    def stop_stream(self):        self.camera.stop_preview()
These widgets are imported in a Python Qt5 Application run on Respective Lite Version OS after installing xserver-xorg, x11-xserver-utils and xinit

Something similar to DRM was happening in the old setup, I was able to display the camera over a portion of my GUI (the mouse pointer vanished when hovering over the video display portion), The plus point was the video feed was perfect, no frameloss and jittering

Now in the new setup as mentioned in the documentation and as tested DRM mode doesn't work with GUI but only in terminal mode, I am using QGlPicamera2 as mentioned in the PiCamera2 library, but I am getting jittering and frameloss, They respectively increase as I move from Pi5 to Pi4B to Pi3B+ (newer code works in all three of them)

For my use case (Displaying GUI with camera feed) the old setup was working perfectly, but Now I want more features in my GUI and Pi5's higher performance will help with that, I also want to use extra serial ports in Pi4B/Pi5 compared to Pi3B+

Is there any way to display my camera feed the way I used to do? Or a way to increase Pi4B/Pi5's graphic performance for video use cases?

As far as I know, the old PiCamera library was last available on Raspbian Buster, which when I tried to boot with Pi4B and Pi5 didn't work

Statistics: Posted by nemog — Wed Aug 07, 2024 12:53 pm



Viewing all articles
Browse latest Browse all 4792

Trending Articles