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

 

posted @ 2015-01-10 20:40  qscqesze  阅读(289)  评论(0编辑  收藏  举报