Point3 operator* (Matx33, Point) bug (Bug #1299)
Description
I have a program with the following line:
cv::Matx33f() * cv::Point2f();
This get me an error:
In file included from /home/chris/src/opencv/opencv/modules/core/include/opencv2/core/core.hpp:4247:0,
from /home/chris/src/opencv/opencv/include/opencv/cv.h:64,
from /home/chris/devel/min_example/main.cpp:1:
/home/chris/src/opencv/opencv/modules/core/include/opencv2/core/operations.hpp: In function ‘cv::Point3_<_Tp> cv::operator*(const cv::Matx<_Tp, 3, 3>&, const cv::Point_<_Tp>&) [with Tp = float]’:
/home/chris/devel/min_example/main.cpp:5:30: instantiated from here
/home/chris/src/opencv/opencv/modules/core/include/opencv2/core/operations.hpp:642:50: error: no matching function for call to ‘cv::Point3<float>::Point3_(cv::Matx<float, 3, 1>)’
/home/chris/src/opencv/opencv/modules/core/include/opencv2/core/operations.hpp:1503:31: note: candidates are: cv::Point3_<_Tp>::Point3_(const cv::Vec<_Tp, 3>&) [with Tp = float]
/home/chris/src/opencv/opencv/modules/core/include/opencv2/core/operations.hpp:1501:31: note: cv::Point3<_Tp>::Point3_(const CvPoint3D32f&) [with Tp = float, CvPoint3D32f = CvPoint3D32f]
/home/chris/src/opencv/opencv/modules/core/include/opencv2/core/operations.hpp:1500:31: note: cv::Point3<_Tp>::Point3_(const cv::Point_<_Tp>&) [with Tp = float]
/home/chris/src/opencv/opencv/modules/core/include/opencv2/core/operations.hpp:1499:31: note: cv::Point3<_Tp>::Point3_(const cv::Point3_<_Tp>&) [with Tp = float, cv::Point3<_Tp> = cv::Point3_<float>]
/home/chris/src/opencv/opencv/modules/core/include/opencv2/core/operations.hpp:1498:31: note: cv::Point3_<_Tp>::Point3_(Tp, _Tp, _Tp) [with _Tp = float]
/home/chris/src/opencv/opencv/modules/core/include/opencv2/core/operations.hpp:1497:31: note: cv::Point3<_Tp>::Point3_() [with _Tp = float]
In plain words: There is no constructor for Point3_<_Tp>(const Matx<_Tp, 3, 1> &m) but operator* in operations.hpp depends on this. I tried to fix it by creating the relevant constructor but I get "is ambiguous" errors in other corners of the code.
Also occurs with:
cv::Matx33f() * cv::Point3f()
But not with
cv::Matx33f() * cv::Vec3f()
A workaround is using:
cv::Mat(cv::Matx33f()) * cv::Point2f()
This occurs with SVN and OpenCV 2.3.1.
On Ubuntu 11.04.
Compiler: gcc 4.5.2-8ubuntu4 (4.5.2)
Compiled like this: $ gcc main.cpp (and in normal life using cmake).
Associated revisions
fixed Matx33 * Point3 and Matx22 * Point operators (ticket #1299)
another attempt to fix #1299
another attempt to fix #1299
Merge pull request #1299 from jet47:gpu-cuda-rename
History
Updated by Vadim Pisarevsky over 13 years ago
thanks! The operators (for Point and Point3) have been fixed in r6454
- Status changed from Open to Done
- (deleted custom field) set to fixed
Updated by Christoph Siedentop over 13 years ago
You completely missed the point. Whatever you fixed, it wasn't this bug.
Anyway, I attached a patch. It has a test that reproduces my error and the appropriate fix. The fix might not be as elegant as it could be but at least it's a fix.
Regards,
Christoph
- Status changed from Done to Cancelled
- (deleted custom field) deleted (
fixed)
Updated by Vadim Pisarevsky over 13 years ago
thanks! now it should be fixed properly
- Status changed from Cancelled to Done
- (deleted custom field) set to fixed
Updated by Christoph Siedentop over 13 years ago
Why did you not include the test in the commit?
Updated by Vadim Pisarevsky over 13 years ago
sorry. added in r6510