赞
踩
1:代码如下:
- #include "stdafx.h"
- #include"highgui.h"
- #include"cv.h"
- void PrintMat2(CvMat*target, char * name)//第一个参数为cvMat矩阵指针,第二个参数为输出的矩阵的名字
- {
- printf("%s:\n", name);
- for (int i=0; i<target->rows; i++)
- {
- for (int j=0; j<target->cols;j++)
- {
- printf("%f\t", cvmGet(target, i,j));
- }
- printf("\n");
- }
- }
- int main()
- {
- float vals[]={0.866,-0.500,0.500,0.866};
- CvMat rotmat;
- //cvInitMatHeader(CvMat矩阵指针,行数,列数,数据类型,一维矩阵指针)
- cvInitMatHeader(&rotmat,2,2,CV_32FC1,vals);
- PrintMat2(&rotmat,"romat");
- return 0;
- }
Copyright © 2003-2013 www.wpsshop.cn 版权所有,并保留所有权利。