Ask Your Question

Revision history [back]

click to hide/show revision 1
initial version

main difference between addWeighted() and blendLinear() is, that the latter has weights per pixel for each image. do you have such a thing ?

main difference between addWeighted() and blendLinear() is, that the former has a single blending factor for the whole image, and the latter has a weights per pixel Mat for each image.

do you have such a thing ??

as an example:

Mat_<uchar> m1(2,2); 
m1 << 1,1,
      1,1;

Mat_<uchar> m2(2,2); 
m2 << 3,3,
      3,3;

Mat_<float> w1(2,2);
w1 << .2, .4,
      .4, .2;

Mat w2 = 1.0f - w1;

Mat result;
blendLinear(m1, m2, w1, w2, result);

cout << result << endl;

[  3,   2;
   2,   3]

main difference between addWeighted() and blendLinear() is, that the former has a single blending factor for the whole image, and the latter has a weights per pixel Mat for each image.

do you have such a thing ?

as an example:

Mat_<uchar> m1(2,2); 
m1 << 1,1,
      1,1;

Mat_<uchar> m2(2,2); 
m2 << 3,3,
      3,3;

Mat_<float> w1(2,2);
w1 << .2, .4,
.4, // 0.2 * 1st_pixel, 0.4 * 2nd_pixel, etc.
      .4, .2;

Mat w2 = 1.0f - w1;

Mat result;
blendLinear(m1, m2, w1, w2, result);

cout << result << endl;

[  3,   2;
   2,   3]

main difference between addWeighted() and blendLinear() is, that the former has a single blending factor for the whole image, and the latter has a weights per pixel Mat for each image.

do you have such a thing ?

as an example:

Mat_<uchar> m1(2,2);   // 1st "demo" image
m1 << 1,1,
      1,1;

Mat_<uchar> m2(2,2);   // 2nd image
m2 << 3,3,
      3,3;

Mat_<float> w1(2,2);
w1(2,2);  // weights
w1 << .2, .4,  // 0.2 * 1st_pixel, 0.4 * 2nd_pixel, etc.
      .4, .2;

Mat w2 = 1.0f - w1;

Mat result;
blendLinear(m1, m2, w1, w2, result);

cout << result << endl;

[  3,   2;
   2,   3]