Ask Your Question

Revision history [back]

mapping depends of linTr_ Mat and shift_

mapping depends of linTr_ Mat and shift_shift_

see sample

mapping depends of linTr_ Mat and shift_ It is a constant map because there is no method to change transfomr. You can set affine transform only in constructor (You can compose current map with another map)

see sample

mapping depends of linTr_ Mat and shift_ It is a constant map because there is no method to change transfomr. You can set affine transform only in constructor (You can compose current map with another map)

see sample

All is in sample :

Simulate a transformation img1 (reference) in img2 new image img2= [linTr shift] img1

Matx<double, 2, 2> linTr(1., 0.1, -0.01, 1.);
Vec<double, 2> shift(1., 1.);
MapAffine mapTest(linTr, shift);
mapTest.warp(img1, img2);

Now we want to find a transformation between img1 and img2. Of course projTr is unknown

MapperGradAffine mapper;
MapperPyramid mappPyr(mapper);
Ptr<Map> mapPtr;
mappPyr.calculate(img1, img2, mapPtr);

we find an estimation of projTr

--- Testing affine mapper ---
real --> [1, 0.1;
 -0.01, 1]
[1;
 1]
estimated --> [0.9999473655589267, 0.1009308875914515;
 -0.009985648108361955, 0.9998113921559071]
[0.9551427088080436;
 1.024064674225132]

and finally we transform img2 in dest to check difference between img1 and dest. We must inverse transformation using inverseWarp :

Mat dest;
mapAff->inverseWarp(img2, dest);
showDifference(img1, dest, DIFF_REGPIX_IM);