Reputation: 6828
I want to set the type of a cv::Mat
object to CV_32F
, but I don't care (at declaration time) of the matrix size.
There is any other way to do this:
cv::Mat m (0,0,CV_32F);
Something like:
cv::Mat m;
m.setType(CV_32F);
Upvotes: 1
Views: 839
Reputation: 17265
The simple answer is use cv::Mat1f
or e.g. cv::Mat3f
(as @Miki suggested).
However, the place where it actually matters is at allocation time, so there's no problem just leaving m
as is, and when you actually come to allocate it to the desired size, set it there (e.g. with cv::Mat::create()
.
If m
is just passed it auto allocating functions, then you don't actually need to set it at all.
Upvotes: 1