getAffineTransform(): No error handling with aligned points (Bug #3305)


Added by Arnaud Ramey over 3 years ago. Updated almost 2 years ago.


Status:Open Start date:2013-10-07
Priority:Normal Due date:
Assignee:Vadim Pisarevsky % Done:

0%

Category:imgproc, video
Target version:Next Hackathon
Affected version:2.4.6 (latest release) Operating System:Any
Difficulty:Medium HW Platform:Any
Pull request:

Description

Let A and B be sets of 3 points.
If the points in A or in B are aligned,
no affine transformation exists that match A to B in most cases.

However, in such a case, cv::getAffineTransform() returns a matrix with no complain
but containing invalid data.
It would be nice to cast an error, or at least to specify the behavior in the documentation.

Minimal example:

cv::Point2f A_sample[3];
A_sample[0] = cv::Point2f(8, 9);
A_sample[1] = cv::Point2f(40, 41);
A_sample[2] = cv::Point2f(47, 48);
cv::Point2f B_sample[3];
B_sample[0] = cv::Point2f(7.37465, 11.8295);
B_sample[1] = cv::Point2f(15.0113, 12.8994);
B_sample[2] = cv::Point2f(38.9943, 9.56297);
cv::Mat trans = cv::getAffineTransform(A_sample, B_sample);
std::cout << "trans:" << trans << std::endl;
___________________

Output:
___________________
trans:[-8245045546463036, 8245045546463037, -8245045546463042;
       1319381983356685, -1319381983356685, 1319381983356699]


History

Updated by Kirill Kornyakov over 3 years ago

Arnaud Ramey, thank you for the report, but it would be great if you could work on a pull request: http://code.opencv.org/projects/opencv/wiki/How_to_contribute.

  • Target version set to Next Hackathon
  • HW Platform changed from x86 to Any
  • Operating System changed from Linux to Any
  • Difficulty changed from Easy to Medium
  • Status changed from New to Open
  • Description changed from Let A and B be sets of 3 points. If the points in A or in B are aligned, no ... to Let A and B be sets of 3 points. If the points in A or in B are aligned, no ... More

Updated by Maksim Shabunin almost 2 years ago

Issue has been transferred to GitHub: https://github.com/Itseez/opencv/issues/4634

Also available in: Atom PDF