Smooth Image

1. OS: Win7

    IDE: VS2010

 

2. Include Directories: ....../OpenCV2.2/include

                                    ....../OpenCV2.2/include/opencv

    Library Directories: ....../OpenCV2.2/lib

    Additional Dependencies: opencv_core220d.lib, opencv_highgui220d.lib, opencv_imgproc220d.lib

 

3. Code:

 

#include "stdafx.h"
#include <cv.h>
#include <cxcore.h>
#include <highgui.h>


int _tmain(int argc, _TCHAR* argv[])
{
 // Create window for showing image
 cvNamedWindow("SourceImage", CV_WINDOW_AUTOSIZE);
 cvNamedWindow("SmoothImage", CV_WINDOW_AUTOSIZE);

 

 // Load source image and create a new image as the same size
 IplImage * source = cvLoadImage("Source Image Path");
 IplImage * smoothImage = cvCreateImage(cvGetSize(source), IPL_DEPTH_8U, 3);

 // Smooth Filter (CV_GAUSSIAN, CV_BLUR_NO_SCALE, CV_BLUR, CV_MEDIAN, CV_BILATERAL)
 //cvSmooth(source, smoothImage, CV_GAUSSIAN, 3, 3);
 //cvSmooth(source, smoothImage, CV_BLUR, 3, 3);
 //cvSmooth(source, smoothImage, CV_BLUR_NO_SCALE, 3, 3);
 //cvSmooth(source, smoothImage, CV_MEDIAN, 3, 3);
 //cvSmooth(source, smoothImage, CV_BILATERAL, 3, 3, 11, 11);
 
 // Show source image and the image after smoothing
 cvShowImage("SourceImage", source);
 cvShowImage("SmoothImage", smoothImage);

 // Wait Keyboard Event
 cvWaitKey(0);

 // Release image
 cvReleaseImage(&source);
 cvReleaseImage(&smoothImage);

 // Destroy window


 cvDestroyWindow("SourceImage");
 cvDestroyWindow("SmoothImage");
 return 0;
}

  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 2
    评论
评论 2
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值