1 | initial version |
maybe a simple mean subtraction will already get you close:
Scalar m1,d1;
meanStdDev(im1,m1,d1); // "lower"
Scalar m2,d2;
meanStdDev(img2,m2,d2); //"upper"
cerr << m1 << d1 << endl;
cerr << m2 << d2 << endl;
Scalar mdiff = m1-m2;
img1 -= mdiff;
Scalar m3,d3;
meanStdDev(img1 ,m3, d3);
cerr << m3 << d3 << endl;
[128.965, 129.764, 131.6, 0][61.9842, 62.0493, 57.8344, 0] // img1
[44.4416, 79.0048, 72.5779, 0][16.5399, 34.9685, 31.0255, 0] // img2
[53.9764, 82.1853, 77.0983, 0][48.514, 56.5164, 49.9328, 0] // result