Ask Your Question
0

Wrong matrix from getAffineTransform

asked 2013-04-12 04:59:40 -0600

matteo gravatar image

I need to use Affine Transformation algorithm in order to find a matrix (that describes the Af.Tr. between two images which I took 3 matching points from) and afterwards multiply it for some coordinates (that represent some points in the first frame) in order to find the respective points in the second. I'm trying to experiment the OpenCV function getAffineTransform with 3 points that stay still. this is my code:

Point2f terp1[]={Point2f(1,1),Point2f(30,1),Point2f(30,30)};    
Point2f terp2[]={Point2f(1,1),Point2f(30,1),Point2f(30,30)};

 Mat A_m( 2, 3, CV_32FC1 );
   A_m = getAffineTransform(terp1,terp2);


  PrintMatrix(A_m);

I expect the matrix to be: 1 0 0 / 0 1 0 .....but i recive (from PrintMatrix function) huge numbers that don't make sense as 2346027296 32673544 32900240 // 2346027296 32673544 32900240

why?

edit retag flag offensive close merge delete

Comments

which OpenCV-version are you using?

Guanta gravatar imageGuanta ( 2013-04-12 07:39:23 -0600 )edit

1 answer

Sort by ยป oldest newest most voted
3

answered 2013-04-12 07:38:36 -0600

Guanta gravatar image

Your example works fine for me. You must print it wrongly! Try std::cout << A_m << std::endl;

edit flag offensive delete link more

Comments

thanks...i'm stupid :)

matteo gravatar imagematteo ( 2013-04-12 08:28:16 -0600 )edit

Question Tools

Stats

Asked: 2013-04-12 04:59:40 -0600

Seen: 491 times

Last updated: Apr 12 '13