复制: cvCopy(img1,img2);
保存:cvSaveImage(filename,img);
OpenCV实现对图的保存和复制大概就是这两个函数把
必须要提的是:OpenCV不支持中文路径!!!!!
如果你用下面的代码,就会出错:
IplImage *pImg = cvLoadImage("d:/测试10.jpg");
IplImage* pImg2 = cvCreateImage(cvGetSize(pImg),pImg->depth,pImg->nChannels);
cvCopy(pImg,pImg2,NULL);
cvSaveImage("d:/我哦.jpg",pImg2);
cvNamedWindow("image",1);
cvShowImage("image",pImg);
cvNamedWindow("imageCopy",1);
cvShowImage("imageCopy",pImg2);
cvWaitKey(0);
cvDestroyWindow("image");
cvDestroyWindow("imageCopy");
cvReleaseImage(&pImg);
cvReleaseImage(&pImg2);
cvWaitKey(0);
因为使用了中文路径,所以会出现:
改完路径就好