http://hi.baidu.com/25wensanmu/item/bd8b0718cdbf0e0ee75c3607
Mat img2 = imread(".//img//et000.jpg");
对于单通道,有:
for(int i=0;i<img2.rows;i++)
对于三通道有:
for(int i=0;i<img2.rows;i++)
或者:
template<typename _Tp> _Tp& at(int y,int x);
template<typename _Tp>const _Tp& at(int y,int x)const;
template<typename _Tp> _Tp& at(Point pt);
template<typename _Tp>const _Tp& at(Point pt)const;
// defineded in cxmat.hpp (454-468)
typedefVec<float,2>Vec2f;// cxcore.hpp (254)
// we can access the element like this :
Mat m(Size(3,3), CV_32FC2 );
Vec2f& elem = m.at<Vec2f>( row , col );// or m.at<Vec2f>( Point(col,row) );
elem[0]=1212.0f;
elem[1]=326.0f;
float c1 = m.at<Vec2f>( row , col )[0];// or m.at<Vec2f>( Point(col,row) );
float c2 = m.at<Vec2f>( row , col )[1];
m.at<Vec2f>( row, col )[0]=1986.0f;
m.at<Vec2f>( row, col )[1]=326.0f;