Ask Your Question

Revision history [back]

Translating getPerspectiveTransform to Java

Hello,

Point2f inputQuad[4];
        Point2f outputQuad[4];

// The 4 points that select quadilateral on the input , from top-left in clockwise order
            // These four pts are the sides of the rect box used as input
            inputQuad[0] = Point2f( 0,0);
            inputQuad[1] = Point2f( IPM_ROI.cols,0);
            inputQuad[2] = Point2f( IPM_ROI.cols,IPM_ROI.rows);
            inputQuad[3] = Point2f( 0,IPM_ROI.rows);           //
            // The 4 points where the mapping is to be done , from top-left in clockwise order
            outputQuad[0] = Point2f( 0,0 );
            outputQuad[1] = Point2f( mFrame.cols,0);
            outputQuad[2] = Point2f( mFrame.cols-250,mFrame.rows);
            outputQuad[3] = Point2f( 250,mFrame.rows);

            // Get the Perspective Transform Matrix i.e. IPM_Matrix
            IPM_Matrix = getPerspectiveTransform( inputQuad, outputQuad );

I am translating (not sure i am using the perfect word) to Java for Android, however getPerspectiveTransform in Java takes 2 Mat's here it takes Point2f.

May you please help me with the translation