用opencv改变图片大小(像素、尺寸)

 

#include "cv.h"
#include "highgui.h"
#include "stdio.h"

int main(int argc,char *argv[])
{
 IplImage *image=0,*imageresize=0;
 image=cvLoadImage("lena.jpg",1);
 if(!image) printf("can't load an image/n");
 imageresize=cvCreateImage(cvSize(1000,750),IPL_DEPTH_8U,3);
 cvResize(image,imageresize,CV_INTER_LINEAR);
 cvNamedWindow("lena",1);
 cvNamedWindow("size",1);
 cvShowImage("size",imageresize);
 cvShowImage("lena",image);
 cvWaitKey(0);
 cvReleaseImage(&image);
 cvReleaseImage(&imageresize);
 cvDestroyWindow("size");
 cvDestroyWindow("lena");
 return 0;
} 
自己把图像文件 lena.jpg 添加到建的项目文件运行就可以了! 

 

你可能感兴趣的:(image,include)