Attention! This forum will be made read-only by Dec-20. Please migrate to https://forum.opencv.org. Most of existing active users should've received invitation by e-mail.

# Revision history [back]

### estimateRigidTransform returns non sensical values

Hi all,

I am trying to estimate an affine transform from two point sets. Here is the sample code that I am running to verify estimateRigidTransform.

std::vector< Point2f > obj1; std::vector< Point2f > scene1; for (int i=0;i<10;i++) { obj1.push_back(Point2f(i,i+10)); scene1.push_back(Point2f(i+10,i+20)); } Mat H1 = estimateRigidTransform(obj1,scene1,false); cout << H1 << endl;

The output I get is: [-4.836697827223e-026, -4.836697827223e-026, -4.836697827223e-026; -4.836697827223e-026, -4.836697827223e-026, -4.836697827223e-026]

What am I doing wrong?

Also, I would like to estimate the transformation robustly. Is there any sample code there for using RANSAC/or other robust methods on top of estimateRigidTransform?

Thanks HIy

 2 formated code for better readability Guanta 6736 ●6 ●25 ●79

### estimateRigidTransform returns non sensical values

Hi all,

I am trying to estimate an affine transform from two point sets. Here is the sample code that I am running to verify estimateRigidTransform.

std::vector< Point2f > obj1;
std::vector< Point2f > scene1;
for (int i=0;i<10;i++)
{
obj1.push_back(Point2f(i,i+10));
scene1.push_back(Point2f(i+10,i+20));
}
Mat H1 = estimateRigidTransform(obj1,scene1,false);
cout << H1 << endl;endl;


The output I get is: is:

[-4.836697827223e-026, -4.836697827223e-026, -4.836697827223e-026;
-4.836697827223e-026, -4.836697827223e-026, -4.836697827223e-026]-4.836697827223e-026]


What am I doing wrong?

Also, I would like to estimate the transformation robustly. Is there any sample code there for using RANSAC/or other robust methods on top of estimateRigidTransform?

Thanks HIy