2
* @file Laplace_Demo.cpp
3
* @brief Sample code showing how to detect edges using the Laplace operator
7
#include "opencv2/imgproc/imgproc.hpp"
8
#include "opencv2/imgcodecs.hpp"
9
#include "opencv2/highgui/highgui.hpp"
18
int main( int, char** argv )
21
Mat src, src_gray, dst;
26
const char* window_name = "Laplace Demo";
29
src = imread( argv[1] );
34
/// Remove noise by blurring with a Gaussian filter
35
GaussianBlur( src, src, Size(3,3), 0, 0, BORDER_DEFAULT );
37
/// Convert the image to grayscale
38
cvtColor( src, src_gray, COLOR_RGB2GRAY );
41
namedWindow( window_name, WINDOW_AUTOSIZE );
43
/// Apply Laplace function
46
Laplacian( src_gray, dst, ddepth, kernel_size, scale, delta, BORDER_DEFAULT );
47
convertScaleAbs( dst, abs_dst );
50
imshow( window_name, abs_dst );