#include <iostream>
#include <opencv2/opencv.hpp>
#include <opencv2/highgui.hpp>
using namespace std;
using namespace cv;
int main(int argc, const char * argv[]) {
// insert code here...
float vals[] = {0.866025,-0.500000,0.500000,0.866025};
CvMat rotmat;
cvInitMatHeader(&rotmat, 2, 2, CV_32FC1,vals);
cout<<"rotmat->rows = "<<rotmat.rows<<endl;
cout<<"rotmat->clos = "<<rotmat.cols<<endl;
cout<<"rotmat->step = "<<rotmat.step<<endl; //表示行数据长度(单位是字节数)
for(unsigned int i = 0;i<rotmat.rows;i++)
{
for(unsigned int j = 0;j<rotmat.cols;j++)
{
cout<<i<<","<<j<<"->"<<*(rotmat.data.fl + i*rotmat.rows + j)<<endl; //普通提取
cout<<i<<","<<j<<"->"<<*((float *)(rotmat.data.ptr + i * rotmat.step) + j)<<endl; //取uchar进行强转 偏移
}
}
return 1;
}