首页 > 代码库 > opencv第二课 进行缩放图片~

opencv第二课 进行缩放图片~

 

#include<stdio.h>#include<iostream>#include<opencv2\opencv.hpp>using namespace std;using namespace cv;int main(){    const char *windowsrctitle = "before";    const char *windowsdstitle = "after";    double fscale = 0.314;    CvSize czsize;    IplImage *psrcimage = cvLoadImage("D:\\1.jpg",CV_LOAD_IMAGE_UNCHANGED);    IplImage *pdstimage = NULL;    czsize.width = psrcimage->width*fscale;    czsize.height = psrcimage->height*fscale;    pdstimage = cvCreateImage(czsize,psrcimage->depth,psrcimage->nChannels);    cvResize(psrcimage,pdstimage,CV_INTER_AREA);    cvNamedWindow(windowsrctitle,CV_WINDOW_AUTOSIZE);    cvNamedWindow(windowsdstitle,CV_WINDOW_AUTOSIZE);    cvShowImage(windowsrctitle,psrcimage);    cvShowImage(windowsdstitle,pdstimage);    cvWaitKey();    return 0;}

 

opencv第二课 进行缩放图片~