Correct approach for overlays using CVBpy

I am porting an application from using the CVImage, CVDisplay and CVGrabber ActiveX controls to CVBpy. We make use of several of the overlay plugins for plain and rotatable rectangles, and cross-hairs, and I would like to know what the recommended way of implementing overlays is with CVBpy.

The documentation is a bit sparse in this respect. Is there built in functionality to do this, or am I going to have to get access to the image buffer as a numpy array and just draw on it? (And would this approach even work?)

Hi @drbsg ,

if you are looking for a “destructive” way (assuming you do not copy the data you are displaying), the Image Pixel Access of this thread might be what you are looking for.

As far as I know, we dont have any custom controls for Python, but as you have access to the imagedata you can use whatever UI Framework you like (I assume).
Thus handling overlays is something you might want to do with the tools of whatever UI Framwork you use.

Thank you for confirming my suspicions.

As I have been building on the QmlStreamDisplay example, I have settled on a solution which uses QML elements to draw the overlays, and it works quite well.


Absolutely makes sense from my point of view. The overlays that were available through the CVDisplay.ocx were inherently bound to the ActiveX control and the underlying CVCDisp.dll. Unfortunately, the possibilities for this DLL to interact with more modern UI infrastructures like WPF or QML are very limited, which is why we basically rebuilt displays for Qt/QML and WPF (only the still-available Forms Display control in Stemmer.Cvb.Forms.Controls still makes use of the CVCDisp.dll).

This unfortunately means that basically the possibilities offered by the original overlay objects are basically lost. On the other hand, display infrastructures like WPF and QML offer new possibilities we did not have before (e. g. native UI widgets directly inside the display, more flexible interactions with display elements, better support for transparencies, animations etc.) that can be harnessed for building a slick UI.

1 Like