• [学习OpenCV攻略][007][缩小图片]


    cvPryDown(输入图片,输出图片)

    根据输出图片的大小,把输入图片进行压缩

    cvPryUp(输入图片,输出图片)

    根据输出图片的大小,把输入图片进行放大

    #include "cv.h"
    #include "highgui.h"
    
    IplImage *doPyrUp(IplImage *in){
    	//assert(in->width%2 == 0 && in->height%2 == 0);
    	
    	//IplImage *out = cvCreateImage(cvSize(in->width/2, in->height/2), in->depth, in->nChannels);
    	IplImage *out = cvCreateImage(cvSize(in->width*2, in->height*2), in->depth, in->nChannels);
    	
    	//cvPyrDown(in, out);
    	cvPyrUp(in, out);
    	
    	return out;
    }
    
    int main(int argc, char **argv){
    	IplImage *img = cvLoadImage(argv[1]);
    	//IplImage *img2 = cvCreateImage(cvSize(img->width/2, img->height/2), img->depth, img->nChannels);
    	IplImage *img2 = cvCreateImage(cvSize(img->width*2, img->height*2), img->depth, img->nChannels);
    	
    	cvNamedWindow("hello1", CV_WINDOW_AUTOSIZE);
    	cvNamedWindow("hello2", CV_WINDOW_AUTOSIZE);
    	cvShowImage("hello1", img);
    	
    	//img2 = doPyrDown(img);
    	img2 = doPyrUp(img);
    	
    	cvShowImage("hello2", img2);
    	
    	cvWaitKey(0);
    	
    	cvReleaseImage(&img);
    	cvReleaseImage(&img2);
    	cvDestroyWindow("hello1");
    	cvDestroyWindow("hello2");
    	
    	return 0;
    }
    
  • 相关阅读:
    ssh框架整合
    spring事务管理
    spring AOP
    spring静态代理和动态代理
    log4j介绍
    Socket通信介绍
    C# 串口与窗体应用程序的连接
    Halcon中的图像相减算子abs_diff_image和sub_image
    R-CNN、fast-RCNN、faster-RCNN到yolo、SSD简要
    QT入门系列(2):MinGW与MSVC编译的区别
  • 原文地址:https://www.cnblogs.com/d442130165/p/4918756.html
Copyright © 2020-2023  润新知