xtal256
Posts: 14
Joined: Sat Aug 26, 2017 8:34 am

How many overlays is "too many" in PiCamera

Mon May 06, 2019 3:46 am

In the documentation for picamera.PiCamera.add_overlay, it says:
If too many overlays are added, the display output will be disabled and a reboot will generally be required to restore the display.
It then goes on to say that the exact number depends on a number of factors.

I am planning on testing it, by adding more and more overlays, it until it breaks. But for now I'd like to know what experience other people have had with overlays. How many can I reasonably expect to add?

Lets say I have a 1920x1080 screen, and I will be adding overlays that range in size from 200x300 to 1000x200, and they are unlikely to overlap. I expect to need between 2 to 8 separate overlays. Would 10 be fine? Or would that be pushing it?

6by9
Raspberry Pi Engineer & Forum Moderator
Raspberry Pi Engineer & Forum Moderator
Posts: 8918
Joined: Wed Dec 04, 2013 11:27 am
Location: ZZ9 Plural Z Alpha, aka just outside Cambridge.

Re: How many overlays is "too many" in PiCamera

Tue May 07, 2019 3:07 pm

The main limiting criteria is having to scale the images.

The hardware is composing the HDMI (or DSI, or DPI) output "live", therefore it has to be able to retrieve all the source data for a line and compose them within the time it takes for one line to be scanned out. If you scale an image then it needs to read 2 or more lines from the source image, and that has an additional cost.
If all your source images are displayed at 1:1, and even better if not overlapping, then you can almost certainly get away with 10. IIRC people have managed to run low resolution video walls with 3x3 WVGA (640x360) video streams being composed onto a 1080P output without significant issue. As soon as you introduce scaling into that then you are likely to be asking for problems.
Software Engineer at Raspberry Pi Trading. Views expressed are still personal views.
I'm not interested in doing contracts for bespoke functionality - please don't ask.

xtal256
Posts: 14
Joined: Sat Aug 26, 2017 8:34 am

Re: How many overlays is "too many" in PiCamera

Wed May 08, 2019 12:58 am

Thanks for your detailed and helpful response.

By scaling an image, do you mean providing an image as source data to "add_overlay" but providing a size other than the image's natural size?
If so then I am definitely not doing that, so I should be ok.

6by9
Raspberry Pi Engineer & Forum Moderator
Raspberry Pi Engineer & Forum Moderator
Posts: 8918
Joined: Wed Dec 04, 2013 11:27 am
Location: ZZ9 Plural Z Alpha, aka just outside Cambridge.

Re: How many overlays is "too many" in PiCamera

Wed May 08, 2019 8:15 am

xtal256 wrote:
Wed May 08, 2019 12:58 am
By scaling an image, do you mean providing an image as source data to "add_overlay" but providing a size other than the image's natural size?
If so then I am definitely not doing that, so I should be ok.
Requesting an XxY image to be displayed on the screen as anything other than an XxY region. eg putting a 720P video fullscreen onto a 1080P display would require upscaling, and putting a 1080P video on a 720P display would require downscaling. Both require additional image context to generate one display line.
Software Engineer at Raspberry Pi Trading. Views expressed are still personal views.
I'm not interested in doing contracts for bespoke functionality - please don't ask.

Return to “Camera board”