aihot  2017-05-18 01:46:51  图像处理 |   查看评论   
cvmSet( CvMat* mat, int row, int col, double value); cvmGet( const CvMat* mat, int row, int col ); CvScalar cvGet2D(const CvArr * arr, int idx0, int idx1); //CvArr只作为函数的形参void cvSet2D(CvArr* arr, int idx0, int idx1, CvScalar value);
CvMat * cvmat = cvCreateMat(44, CV_32FC1); cvmat->data.fl[row * cvmat->cols + col] = (float)3.0; CvMat * cvmat = cvCreateMat(44, CV_64FC1); cvmat->data.db[row * cvmat->cols + col] = 3.0;
CvMat * cvmat = cvCreateMat(44, CV_64FC1); CV_MAT_ELEM(*cvmat, double, row, col) = 3.0;
if (CV_MAT_DEPTH(cvmat->type) == CV_32F) CV_MAT_ELEM_CN(*cvmat, float, row, col * CV_MAT_CN(cvmat->type) + ch) = (float)3.0// ch为通道值 if (CV_MAT_DEPTH(cvmat->type) == CV_64F) CV_MAT_ELEM_CN(*cvmat, double, row, col * CV_MAT_CN(cvmat->type) + ch) = 3.0// ch为通道值
for (int row = 0; row < cvmat->rows; row++) {  p = cvmat ->data.fl + row * (cvmat->step / 4);for (int col = 0; col < cvmat->cols; col++)  {  *p = (float) row + col;  *(p+1) = (float)row + col + 1;  *(p+2) = (float)row + col + 2;  p += 3;  } } CvMat * vector = cvCreateMat(1,3, CV_32SC2);CV_MAT_ELEM(*vector, CvPoint, 00) = cvPoint(100,100); CvMat * vector = cvCreateMat(1,3, CV_64FC4);CV_MAT_ELEM(*vector, CvScalar, 00) = CvScalar(0000);

 复制矩阵操作:

View Code
CvMat* M1 = cvCreateMat(4,4,CV_32FC1); CvMat* M2; M2=cvCloneMat(M1);

 

3.Mat

Mat是opencv2.0推出的处理图像的新的数据结构,现在越来越有趋势取代之前的cvMat和lplImage,相比之下Mat最大的好处就是能够更加方便的进行内存管理,不再需要  首页 上一页 1 2 3 4 5 6 下一页 尾页

 

除特别注明外,本站所有文章均为 赢咖4注册 原创,转载请注明出处来自IplImage, CvMat, Mat 的关系和相互转换

留言与评论(共有 0 条评论)
   
验证码:
[lianlun]1[/lianlun]