Reputation: 517
If I have a matrix of type CV_32SC1
, what typename should I use in function Mat::at
?
e.g.
Mat X; // for example eye matrix of size 10,10,and type CV_32SC1
X.at<??????>(1,1)=5;
How can I find the typename for other matrix types?
Upvotes: 16
Views: 25487
Reputation: 60034
CV_32SC1 is a 1 Channel of Signed 32 bit integer, then I think that X.at<int>()
should do.
Mat already 'knows' how to address a pixel, the type just cast the bits to the C++ value you require for the expression evaluation.
I found here some explanation about the notation.
Upvotes: 4
Reputation: 22245
The general rule for Matrices typenames in OpenCV is:
CV_<bit_depth>(S|U|F)C<number_of_channels>
S = Signed integer
U = Unsigned integer
F = Float
So depending on which one of the previous letters (S,U,F) you have, you will be casting <int>
, <unsigned integer>
or <float>
.
Upvotes: 25