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);