forked from oreillymedia/Learning-OpenCV-3_examples
-
Notifications
You must be signed in to change notification settings - Fork 0
/
example_02-05.cpp
38 lines (29 loc) · 936 Bytes
/
example_02-05.cpp
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
#include <opencv2/opencv.hpp>
int main( int argc, char** argv ) {
// Load an image specified on the command line.
//
cv::Mat image = cv::imread(argv[1],-1);
// Create some windows to show the input
// and output images in.
//
cv::namedWindow( "Example 2-5-in", cv::WINDOW_AUTOSIZE );
cv::namedWindow( "Example 2-5-out", cv::WINDOW_AUTOSIZE );
// Create a window to show our input image
//
cv::imshow( "Example 2-5-in", image );
// Create an image to hold the smoothed output
//
cv::Mat out;
// Do the smoothing
// ( Note: Could use GaussianBlur(), blur(), medianBlur() or
// bilateralFilter(). )
//
cv::GaussianBlur( image, out, cv::Size(5,5), 3, 3);
cv::GaussianBlur( out, out, cv::Size(5,5), 3, 3);
// Show the smoothed image in the output window
//
cv::imshow( "Example 2-5-out", out );
// Wait for the user to hit a key, windows will self destruct
//
cv::waitKey( 0 );
}