Smooth Image

艾原
2023-12-01

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

 类似资料:

相关阅读

相关文章

相关问答