'Computer Vision'에 해당되는 글 1건

  1. 2013.03.28 OpenCV Inverse Affine Matrix
posted by photalks 2013. 3. 28. 14:29


/**

 * Create an inv affine transform matrix from an affine transform matrix

 *

 * @param affine    The 2 x 3 CV_32FC1|CV_64FC1 affine matrix

 * @param invaffine The 2 x 3 CV_32FC1|CV_64FC1 affine matrix to be created

 */

CVAPI(void) cvInvAffine( const CvMat* affine, CvMat* invaffine )

{


    CV_ASSERT( affine->rows == 2 && affine->cols == 3 );

    CV_ASSERT( invaffine->rows == 2 && invaffine->cols == 3 );

    CV_ASSERT( affine->type == invaffine->type );

    

    CvMat* Affine = cvCreateMat( 3, 3, affine->type );

    CvMat* InvAffine = cvCreateMat( 3, 3, affine->type );

    CvMat invaffinehdr;

    cvSetIdentity( Affine );

    cvSetRows( affine, Affine, 0, 2 );

    cvInv( Affine, InvAffine );

    cvSetRows( InvAffine, invaffine, 0, 2 );

    cvReleaseMat( &Affine );

    cvReleaseMat( &InvAffine );

}