getAffineTransform(): No error handling with aligned points (Bug #3305)
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.
cv::Point2f A_sample; A_sample = cv::Point2f(8, 9); A_sample = cv::Point2f(40, 41); A_sample = cv::Point2f(47, 48); cv::Point2f B_sample; B_sample = cv::Point2f(7.37465, 11.8295); B_sample = cv::Point2f(15.0113, 12.8994); B_sample = 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]
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