Ask Your Question

Revision history [back]

click to hide/show revision 1
initial version

Error: The document of the warpAffine is not in accordance with the source code

The warpAffine's document says about the parameter flags:

flags: combination of interpolation methods (see InterpolationFlags) and the optional flag WARP_INVERSE_MAP that means that M is the inverse transformation ( dst→src ).

which means the M will be inverted when WARP_INVERSE_MAP is set. But in the source code of the warpAffine

if( !(flags & WARP_INVERSE_MAP) )
{
    double D = M[0]*M[4] - M[1]*M[3];
    D = D != 0 ? 1./D : 0;
    double A11 = M[4]*D, A22=M[0]*D;
    M[0] = A11; M[1] *= -D;
    M[3] *= -D; M[4] = A22;
    double b1 = -M[0]*M[2] - M[1]*M[5];
    double b2 = -M[3]*M[2] - M[4]*M[5];
    M[2] = b1; M[5] = b2;
}

it says the M will be inverted default, i.e., when the WARP_INVERSE_MAP is NOT set.

Do I make a mistake or the document is not in accordance with the source?