码迷,mamicode.com
首页 > 其他好文 > 详细

opencv第二课 进行缩放图片~

时间:2015-01-10 21:00:50      阅读:188      评论:0      收藏:0      [点我收藏+]

标签:

 

#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第二课 进行缩放图片~

标签:

原文地址:http://www.cnblogs.com/qscqesze/p/4215586.html

(0)
(0)
   
举报
评论 一句话评论(0
登录后才能评论!
© 2014 mamicode.com 版权所有  联系我们:gaon5@hotmail.com
迷上了代码!