opencv Mat資料的三種標準訪問方式
阿新 • • 發佈:2019-01-28
轉載: http://www.cnblogs.com/phillips/p/4484717.html?utm_source=tuicool&utm_medium=referral
Mat_<uchar>---------CV_8U
Mat<char>-----------CV_8S
Nat_<short>---------CV_16S
Mat_<ushort>--------CV_16U
Mat_<int>-----------CV_32S
Mat_<float>----------CV_32F
Mat_<double>--------CV_64F
1 int ROWS = 100; // height
2 int COLS = 200; // width
3 Mat img1(ROWS , COLS , CV_32FC1);
4
5 for (int i=0; i<ROWS ; i++)
6 {
7 for (int j=0; j<COLS ; j++)
8 {
9 img1.at<float>(i,j) = 3.2f;
10 }
11 }