The inputs to the blending operation are grayscale values from 0.0 to 1.0 from the underlying image (Y u ) and RGB values from 0.0 to 1.0 from the superimposed image (RGB s ), and an opacity value from 0.0 to 1.0 (A).
The output is a single image containing RGB values (RGB o ) blended as:
R o = R s * A + Y u * (1-A)
G o = G s * A + Y u * (1-A)
B o = B s * A + Y u * (1-A)