Hi all,
As some of you know I am working on a project to show a camera feed on screen and also save it on disk at the same time.
I have done several tests using gstreamer, ffmpeg and also a modified "yavta" version from 6by9. It looks like for our purposes we'd prefer working with MMAL directly as done in 6by9's example.
What I can't figure out from the (limited) MMAL documentation, is the preferred way to draw overlays on top of the UYVY camera feed coming in. What we want is some simple info (like the current date, time, and other small texts) but ALSO some graphics like battery icons and other status icons. We'd prefer to have these assats saved as PNG's (including transparent background) and plot these on top of the video feed, including transparency and with a sem-transparent background bar (like half-grey).
I have found this:
https://github.com/t-moe/rpi_mmal_examp ... ode.c#L121
But that ain't working. It looks like this is build for other image types (RBG?) than the images I have.
Where can I find more documentation on how to build overlays (and perhaps other tricks) using MMAL ?
Note I am new to image/camera/video programming, but I do have experience with C(++).
We're still in the R&D phase of our project; so we are still flexible on stuff like programming language, although just by looking at the experience of our development team we'd prefer C or C++.
Any pointers ?
Re: Overlay drawing on frame(s) using MMAL
Search for HermannSW posts I think he does this sort of stuff.
viewtopic.php?p=1930038&hilit=Crosshairs#p1930038
I have done it with OpenVG but that won't work on the VC6 Pi4's.
viewtopic.php?p=1930038&hilit=Crosshairs#p1930038
I have done it with OpenVG but that won't work on the VC6 Pi4's.
I'm dancing on Rainbows.
Raspberries are not Apples or Oranges
Raspberries are not Apples or Oranges
Re: Overlay drawing on frame(s) using MMAL
Thanks. I checked out those posts and samples but still have difficulty. Also can't find real good documentation on how to use MMAL.Gavinmc42 wrote: ↑Thu Dec 22, 2022 11:17 amSearch for HermannSW posts I think he does this sort of stuff.
viewtopic.php?p=1930038&hilit=Crosshairs#p1930038
I have done it with OpenVG but that won't work on the VC6 Pi4's.
Are there any "hidden docs" or something? I can see there are some overlay features in MMAL, but can't find the specs.
Re: Overlay drawing on frame(s) using MMAL
No MMAL, no doc, but lots of C code using dispmanx ...
https://github.com/AndrewFromMelbourne/raspidmx
https://github.com/AndrewFromMelbourne/raspidmx
https://stamm-wilbrandt.de/GS_cam_1152x192@304fps
https://github.com/Hermann-SW/RSA_numbers_factored
https://hermann-sw.github.io/planar_graph_playground
https://github.com/Hermann-SW/Raspberry_v1_camera_global_external_shutter
https://stamm-wilbrandt.de/
https://github.com/Hermann-SW/RSA_numbers_factored
https://hermann-sw.github.io/planar_graph_playground
https://github.com/Hermann-SW/Raspberry_v1_camera_global_external_shutter
https://stamm-wilbrandt.de/
Re: Overlay drawing on frame(s) using MMAL
Using an old/outdated version of libpngHermannSW wrote: ↑Thu Jan 26, 2023 10:26 pmNo MMAL, no doc, but lots of C code using dispmanx ...
https://github.com/AndrewFromMelbourne/raspidmx

Re: Overlay drawing on frame(s) using MMAL
Hi, I am the author of that code.
However, the Raspberry Pi has moved on. The DIspmanX API is deprecated.
Not necessarily. That README.md file is 8 years old. The instructions were correct at that time. There is nothing in the code that requires an old or outdated version of libpng.
However, the Raspberry Pi has moved on. The DIspmanX API is deprecated.
I have moved on to DRM/KMS and I hope to port some of my DispmanX examples to DRM/KMS. It is on my very long list of projects.jamesh wrote: dispmanx is indeed deprecated. You will need to revert to FKMS or the earlier graphics system to get dispmanx back.
Or move to DRM.
Re: Overlay drawing on frame(s) using MMAL
Even at times long ago where I did not program in Python (currently I do for some projects, like RSA_numbers_factored.py in 1st signature link), I used sometimes picamera (Python) to play with overlays. Compared to dispmanx all was so much easier to do.
Recently I created Overlays for showing (640x150 and) 640x75 areas in 640x480 camera preview for @csoffa for correctly positioning v2 camera for capturing 640x75@1007fps with raspiraw (he uses that for capturing moving golf ball, below frames are 1ms apart):
viewtopic.php?t=345368&hilit=csoffa#p2070489



I created two gists for him, one with new picamera2 based on new libcamera stack
https://gist.github.com/Hermann-SW/3360 ... d09b2038f5
and one with picamera on legacy camera stack:
https://gist.github.com/Hermann-SW/ec96 ... 5f2c6e666b
Given that camera overlays (with alpha blending!) are so easy to do with picamera[2], you might want to consider using picamera as well:
(the overlay is the same, but below is life camera preview window)
Recently I created Overlays for showing (640x150 and) 640x75 areas in 640x480 camera preview for @csoffa for correctly positioning v2 camera for capturing 640x75@1007fps with raspiraw (he uses that for capturing moving golf ball, below frames are 1ms apart):
viewtopic.php?t=345368&hilit=csoffa#p2070489
I created two gists for him, one with new picamera2 based on new libcamera stack
https://gist.github.com/Hermann-SW/3360 ... d09b2038f5
and one with picamera on legacy camera stack:
https://gist.github.com/Hermann-SW/ec96 ... 5f2c6e666b
Given that camera overlays (with alpha blending!) are so easy to do with picamera[2], you might want to consider using picamera as well:
(the overlay is the same, but below is life camera preview window)
https://stamm-wilbrandt.de/GS_cam_1152x192@304fps
https://github.com/Hermann-SW/RSA_numbers_factored
https://hermann-sw.github.io/planar_graph_playground
https://github.com/Hermann-SW/Raspberry_v1_camera_global_external_shutter
https://stamm-wilbrandt.de/
https://github.com/Hermann-SW/RSA_numbers_factored
https://hermann-sw.github.io/planar_graph_playground
https://github.com/Hermann-SW/Raspberry_v1_camera_global_external_shutter
https://stamm-wilbrandt.de/
Re: Overlay drawing on frame(s) using MMAL
Thanks! I will take a look at that.