Exploring and Idea, Accept camera input add graphic overlay, output to a specific HDMI port? Can It Be done With OpenCV?

Exploring and Idea, Accept camera input add graphic overlay, output to a specific HDMI port? Can It Be done With OpenCV?

Scenario, we have a camera output via HDMI, that is a clear feed, but we would like to add a graphic overlay depending on 3 different scenarios, and output the merged video and graphic to a specific HDMI port. Would like to do this via python on a Raspberry Pi 4 or 5. The video input is via HDMI to USB dongle, and the output via HDMI-A-2, i.e. the 2nd HDMI port of the Pi device.

I have researched if this would be possible using say, FFMPEG, but thought maybe using OpenCV would be a better scenario? Completely new to OpenCV, so seeking advice on if this is doable, and maybe if some has already done this, suggest an example of how it is done?

you don’t need OpenCV for that.

you just need to pop up a GUI for the display, and then use V4L2 to read from the video device, and draw your overlay (with the GUI toolkit).

Well I cannot use GUI system per se, It is HDMI in (via USB) and HDMI out of course.

I need to capture the input video, composite and then send it out the 2nd HDMI port that will be routed to a video hub, and from their routed to various devices.

I will look at V4L2 in depth. I used it a bit for configuration on different project where I had HDMI converting into a Rasberry Pi CSI port. But I barely scratch the surface using V4L2 just enough to set the input resolution.

but no GUI? why not? you have a (HDMI) video output. what else is that good for, if not displaying graphics… with a normal linux graphics subsystem?

you can cheat for now and just use OpenCV’s VideoCapture class to read frames from your video input.

Actually I got my HDMI to CSI interface board to see a connected camera using V4L2. And I got gstreamer to record video.

Odd that was not able to get OBS working with the camera/HDMI to CSI interface. But I know the camera and board work at a basic level I came over to how I can apply graphic overlay and then route the result to the desired HDMI port.