Draw forms with transparency

Hi!

I have to draw some forms like lines or rectangles inside images and I want to do with transparency.
As I have been reading It’s not possible with OpenCv and the workarround is drawing inside an image copy and use addWeighted

cv2.addWeighted(_rgbGeometry, alpha, _rgbFrameOverlay, 1 - alpha, 0, _rgbProcessed);

I wanted to know if it’s possible or will be better to draw inside transparent image and them use addWeighted as I’m using. By doing that I supose that it’s possible to avoid the source image clone step.

With regards,

this might be the wrong library for your purpose.

I know that OpenCv it’s not a library designed for drawing.
I don’t know which library will be better for doing that but … the key here is that I’m using OpenCv because I’m doing more operations with image like, rotation, zoom, perspective transform, motion detection with BackgroundSubstractor

So I have a pipeline with multiple operations that use OpenCv, and if I have the image in OpenCv UMat format I think that will be better to transform to other library format to draw and then continue using OpenCv for other operations.

the question shows up occasionally.

if you just want to blend two opaque images, addWeighted will suffice.

if you want to compose anything with actual alpha channels, OpenCV has no readymade function for this.