Fixed Size Matrix Conversions
This does not compile:
cv::Matx33f M3x3;
cv::Vec3f v3x1 = M3x3.col(0); // compile error
cv::Matx31f m3x1 = M3x3.col(0); // this is ok
with error (on VS2008):
error C2440: 'initializing' : cannot convert from 'cv::Matx<_Tp,m,n>' to 'cv::Vec<_Tp,cn>'
with
[
_Tp=float,
m=3,
n=1
]
and
[
_Tp=float,
cn=3
]
No constructor could take the source type, or constructor overload resolution was ambiguous
That's because although Vec3f
derived from Matx31f
there is no proper constructor that allows this to happen.
So 2 questions:
- What would be the cleanest way to make this assignment.
- Why not add such a constructor?
I guess it would also have to accept this:cv::Vec3f v3x1 = M3x3.row(0);
.