Last active
September 17, 2018 14:24
-
-
Save OctoberWu/6c01da735a3ccb28d2f87d829750c2d3 to your computer and use it in GitHub Desktop.
[fastNlMeansDenoising image filter]#opencv #cpp #img_proc
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
//============================================================================ | |
// Name : imageFilter.cpp | |
// Author : octoberwu | |
// Version : | |
// Copyright : Your copyright notice | |
// Description : Hello World in C++, Ansi-style | |
//============================================================================ | |
#include <opencv2/core/core.hpp> | |
#include <opencv2/highgui/highgui.hpp> | |
#include <opencv2/imgproc/imgproc.hpp> | |
#include <opencv2/photo/photo.hpp> | |
#include <iostream> | |
using namespace cv; | |
using namespace std; | |
int main( int argc, char** argv ) | |
{ | |
if( argc != 2) | |
{ | |
cout <<" Usage: display_image ImageToLoadAndDisplay" << endl; | |
return -1; | |
} | |
Mat image; | |
Mat dstImg; | |
image = imread(argv[1], CV_LOAD_IMAGE_COLOR); // Read the file | |
if(! image.data ) // Check for invalid input | |
{ | |
cout << "Could not open or find the image" << std::endl ; | |
return -1; | |
} | |
Mat grey; | |
cvtColor(image, grey, CV_BGR2GRAY); | |
fastNlMeansDenoising(grey, dstImg, 3, 7, 21); | |
namedWindow("Original Gray one", WINDOW_AUTOSIZE); | |
imshow( "Original Gray one", grey); | |
namedWindow( "Display window", WINDOW_AUTOSIZE );// Create a window for display. | |
imshow( "Display window", dstImg ); // Show our image inside it. | |
waitKey(0); // Wait for a keystroke in the window | |
return 0; | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment