Ask Your Question

Revision history [back]

click to hide/show revision 1
initial version

estimateAffinePartial2D and estimateAffine2D

Hi all,

Can anyone explain me what is the difference between these two: estimateAffinePartial2D and estimateAffine2D?

Are they better/different from estimateRigidTransform?

They are seems to be new kids in the block...

estimateAffinePartial2D and estimateAffine2D

Hi all,

Can anyone explain me what is the difference between these two: estimateAffinePartial2D and estimateAffine2D?

Are they better/different from estimateRigidTransform?

They are seems to be new kids in the block...

My findings: estimateAffinePartial2D and estimateAffine2D return the same results as estimateRigidTransform for float input values BUT if we use int points something weird is returned

std::vector<cv::Point> p1s,p2s;

p1s.push_back(cv::Point( 100, 0));
p1s.push_back(cv::Point( 0, 100));
p1s.push_back(cv::Point(-100, 0));
p1s.push_back(cv::Point( 0,-100));

p2s.push_back(cv::Point(71, -71));
p2s.push_back(cv::Point(71, 71));
p2s.push_back(cv::Point(-71, 71));
p2s.push_back(cv::Point(-71, -71));

// 1.
cv::Mat t_false = cv::estimateRigidTransform(p1s,p2s,false);
std::cout << "estimateRigidTransform false: " << t_false << "\n" << std::flush;

// 2.
cv::Mat t_true = cv::estimateRigidTransform(p1s,p2s,true);
std::cout << "estimateRigidTransform true:" << t_true << "\n" << std::flush;

// 3.
std::vector<uchar> inliers(p1s.size(), 0);
cv::Mat affine1 = cv::estimateAffine2D(p1s, p2s, inliers);
std::cout << "estimateAffine2D" << affine1 << "\n" << std::flush;

// 4.
cv::Mat affine2 = cv::estimateAffinePartial2D(p1s, p2s, inliers);
std::cout << "estimateAffinePartial2D" << affine2 << "\n" << std::flush;

and results:

estimateRigidTransform false: [0.7100000000000001, 0.7100000000000001, 0; -0.7100000000000001, 0.7100000000000001, 0]

estimateRigidTransform true:[0.7100000000000001, 0.7100000000000001, 0; -0.7100000000000001, 0.7100000000000001, 0]

estimateAffine2D[1, -0, -0; -0, 1, -0]

estimateAffinePartial2D[1, -0, 0; 0, 1, 0]