<pre name="code" class="cpp">#include <highgui.h>
using namespace std;
int main()
{
IplImage *img1 = cvLoadImage("test.jpg");
IplImage *img2 = cvCreateImage( cvSize(320,480),IPL_DEPTH_8U,3 );
cvNamedWindow("Example1",CV_WINDOW_AUTOSIZE);
cvShowImage("Example1",img1);
cvWaitKey(0);
cvCopy(img1,img2,NULL);
cvDestroyWindow("Example1");
cvReleaseImage( &img1 );
cvNamedWindow("Example_Copy",CV_WINDOW_AUTOSIZE);
cvShowImage("Example_Copy",img2);
cvSaveImage("D:\\Code\\C++\\OpenCV\\复制、保存图像\\opencv_1\\test_copy.jpg",img2);
cvWaitKey(0);
return 0;
}
在硬盘对应目录下就会复制出一幅新的图像