1、IplImage转Cvmat

   IplImage* src = cvLoadImage("rice.bmp",0);
    CvMat* mat=cvCreateMat(src->height,src->width,CV_32SC1);

   cvConvert(src,mat);

或者:

Cvmat matObj;

* mat=cvGetmat(src,&matObj);

2、Cvmat转IplImage
     IplImage* pImg = cvCreateImage(cvGetSize(mat),8,1);
   
    cvGetImage(matI,pImg);

   cvSaveImage("rice1.bmp",pImg);

posted on 2012-03-08 17:15  知识天地  阅读(449)  评论(0编辑  收藏  举报