thatâs a common task, yet OpenCV hasnât grown any procedures for dealing with it easily.
you said youâre on Android. Android probably has methods for alpha-blending/compositing pictures. getting the GPU to composite your pictures is probably the cheapest way. it certainly is if you only need to display the composite, but also if you need to continue working with the composite (save it or whatever).
math basics: you have two pictures, A as the base, B being the overlay (on top). Bâs alpha channel determines, per-pixel, how much of a pixelâs color comes from B (and the remainder/complement comes from A), so:
C = B * alpha + A * (1 - alpha)
if alpha values were in the range of 0âŚ1. if theyâre in the range of 0âŚ255, youâd need an appropriate division to finish it off, and wide enough data types in between (16 bits at least).
if you had to use OpenCV for this, it might involve cv::split() to isolate color and alpha channels, and some basic math operations on whole Mat objects.