Gaussian Smooth

#include "stdafx.h"
#include <iostream>

#include "opencv2/opencv.hpp"

using namespace std;
using namespace cv;

void example2_4( IplImage* image )
{
    // Create some windows to show the input
    // and output images in.
    //
    cvNamedWindow( "Example2_4-in", CV_WINDOW_AUTOSIZE );
    cvNamedWindow( "Example2_4-out", CV_WINDOW_AUTOSIZE );
    
    // Create a window to show our input image
    //
    cvShowImage( "Example2_4-in", image );
    
    // Create an image to hold the smoothed output
    //
    IplImage* out = cvCreateImage(
        cvGetSize(image),
        IPL_DEPTH_8U,
        3
    );
    
    // Do the smoothing
    //
    cvSmooth( image, out, CV_GAUSSIAN, 5,5 );
    //cvSmooth( out, out, CV_GAUSSIAN, 5, 5);
    
    // Show the smoothed image in the output window
    //
    cvShowImage( "Example2_4-out", out );
    
    // Be tidy
    //
    cvReleaseImage( &out );

    // Wait for the user to hit a key, then clean up the windows
    //
    cvWaitKey( 0 ); 
    cvDestroyWindow("Example2_4-in" );
    cvDestroyWindow("Example2_4-out" );
    
}
int _tmain(int argc, _TCHAR* argv[])
{
//Create some window to show the input
	//and output images in.

	cvNamedWindow("Example4-in");
	cvNamedWindow("Example4-out");

	//Create a window to show our input image
	

	IplImage* img = cvLoadImage("lena.jpg");
	cvNamedWindow("Example1", CV_WINDOW_AUTOSIZE );
	cvShowImage("Example1", img );
	example2_4( img );
	//  cvWaitKey(0);
	cvReleaseImage( &img );
	cvDestroyWindow("Example1");

	return 0;
}


 

 

 

發表評論
所有評論
還沒有人評論,想成為第一個評論的人麼? 請在上方評論欄輸入並且點擊發布.
相關文章