mag.
mag.

Reputation: 144

Alpha blending with two transparent images

I am trying the alpha blending with two images both have alpha channel in OpenCV.

double r, g, b, a; //source image colors
double Rd, Gd, Bd, Ad; //destination image colors

....

double result_r = r∗a + Rd*(1−a);
double result_g = g∗a + Gd*(1−a);
double result_b = b∗a + Bd*(1−a);
double result_a = a∗a + Ad*(1−a);

It works fine if the destination image is opaque. But I need transparent Images on both source and destination. Are there any other calculation methods or functions of OpenCV?

Regards

Upvotes: 0

Views: 967

Answers (1)

rafaoc
rafaoc

Reputation: 596

Look at the cvFunction addWeighted(). It performs what you need Here is the link

Upvotes: 2

Related Questions