Created
November 8, 2018 18:26
-
-
Save romicofre/50a8a193974eb3d9d6f5272aff5e24aa to your computer and use it in GitHub Desktop.
Filtro Gaussiano en C++ con OpenCV 3
This file contains hidden or 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
| #include <opencv2/opencv.hpp> | |
| using namespace cv; | |
| void imfilter( const cv::Mat & image ) { | |
| // Creando las ventanas | |
| namedWindow( "Imagen Original", WINDOW_AUTOSIZE ); | |
| namedWindow( "Imagen Filtrada", WINDOW_AUTOSIZE ); | |
| // Muestra imagen original// | |
| imshow( "Imagen Original", image ); | |
| // Variable para imagen de salida | |
| Mat out; | |
| // Filtro Gaussiano | |
| GaussianBlur( image, out, Size(3,3), 3, 3); | |
| GaussianBlur( out, out, Size(3,3), 3, 3); | |
| // Muestra imagen filtrada | |
| imshow( "Imagen Filtrada", out ); | |
| // Presiona una tecla para salir | |
| waitKey( 0 ); | |
| destroyWindow( "Imagen Original" ); | |
| destroyWindow( "Imagen Filtrada" ); | |
| } | |
| int main( int argc, char** argv ){ | |
| //imread puede leer “BMP, DIB, JPEG, JPE, PNG, PBM, PGM, PPM, SR, RAS, and TIFF” | |
| Mat img = imread(argv[1],-1); | |
| if( img.empty() ) | |
| return -1; | |
| imfilter( img ); | |
| return 0; | |
| } |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment