zoukankan      html  css  js  c++  java
  • [学习OpenCV攻略][006][平滑图片]

    cvCreateImage(图片大小,像素位数,通道数)

    创建图片,根据输入的图片大小,各个通道像素点的位数,和通道数。像素点宏IPL_DEPTH_8U

    cvGetSize(图片)

    得到图片的大小信息

    cvSmooth(输入图片,输出图片,平滑方式,平滑宽,平滑高)

    输出经过平滑处理后的图片,平滑方式宏CV_GAUSSIAN

    #include "cv.h"
    #include "highgui.h"
    
    void smooth_example(IplImage *image){
    	cvNamedWindow("hello-in", CV_WINDOW_AUTOSIZE);
    	cvNamedWindow("hello-out", CV_WINDOW_AUTOSIZE);
    	
    	cvShowImage("hello-in", image);
    	
    	IplImage *out = cvCreateImage(cvGetSize(image), IPL_DEPTH_8U, 3);
    	
    	cvSmooth(image, out, CV_GAUSSIAN, 5, 5);
    	cvSmooth(out, out, CV_GAUSSIAN, 5, 5);
    	
    	cvShowImage("hello-out", out);
    	
    	cvReleaseImage(&out);
    	
    	cvWaitKey(0);
    	
    	cvDestroyWindow("hello-in");
    	cvDestroyWindow("hello-out");
    }
    
    int main(int argc, char **argv){
    	IplImage *img = cvLoadImage(argv[1]);
    	cvNamedWindow("hello", CV_WINDOW_AUTOSIZE);
    	cvShowImage("hello", img);
    	
    	smooth_example(img);
    	
    	cvReleaseImage(&img);
    	cvDestroyWindow("hello");
    	
    	return 0;
    }
    
  • 相关阅读:
    桌面应用程序ClickOne打包部署
    Linux系统基础5周入门精讲(Linux发展过程)
    Linux系统基础5周入门精讲(服务器介绍)
    算法进阶--动态规划
    行为型模式
    结构型模式
    设计模式
    哈希表--树
    数据结构
    查找排序相关面试题
  • 原文地址:https://www.cnblogs.com/d442130165/p/4918575.html
Copyright © 2011-2022 走看看