void

__(InputArray src, OutputArray dst, int ddepth, int ksize=1, double scale=1, double delta=0, int borderType=BORDER_DEFAULT )__**Laplacian****Parameters**:**src**– Source image.**dst**– Destination image of the same size and the same number of channels as`src`.**ddepth**– Desired depth of the destination image.**ksize**– Aperture size used to compute the second-derivative filters. See`getDerivKernels()`for details. The size must be positive and odd.**scale**– Optional scale factor for the computed Laplacian values. By default, no scaling is applied. See`getDerivKernels()`for details.**delta**– Optional delta value that is added to the results prior to storing them in`dst`.**borderType**– Pixel extrapolation method. See`borderInterpolate()`for details.

#### Steps:

- Load image
- Remove noise by blurring with a Gaussian filter
- Convert to gray-scale.
- Apply the Laplacian operator to find the edges.(Laplacian)
- The resulting image needs to be converted to 8-bit image for display.(convertScaleAbs)
- Show the result

#### Functions:

### Example:

------------#include "opencv2/imgproc/imgproc.hpp" #include "opencv2/highgui/highgui.hpp" #include <stdlib.h> #include <stdio.h> using namespace cv; int main( int argc, char** argv ) { Mat src, gray, dst, abs_dst; src = imread( "lena.jpg" ); /// Remove noise by blurring with a Gaussian filter GaussianBlur( src, src, Size(3,3), 0, 0, BORDER_DEFAULT ); cvtColor( src, gray, CV_RGB2GRAY ); /// Apply Laplace function Laplacian( gray, dst, CV_16S, 3, 1, 0, BORDER_DEFAULT ); convertScaleAbs( dst, abs_dst ); imshow( "result", abs_dst ); waitKey(0); return 0; }------------

I an learning Im Proc with OpenCV. I have a basic question. Does Laplacian Edge detection takes longer time than the Canny or Sobel. If yes, Why?

ReplyDeleteNo. Laplacian operator takes same time that sobel operator takes. However, canny takes more time than others.

DeleteIn both Laplacian and Sobel, edge detection involves convolution with one kernel which is different in case of both. So they take almost same time.

However, canny takes more time since it involves many steps for edge extraction.

Your steps don't match your algorithm. There's no Hough Transform ;)

ReplyDeleteHi. Thanks for pointing out the mistake. I have modified the steps.

Deletethanks

ReplyDeleteWhy would you blur the input image? It seems counter intuitive when trying to detect blur.

ReplyDeleteThis comment has been removed by the author.

ReplyDeleteYou have a mistake in your code. Not an error but a very basic mistake. Check shis code and you will find it: http://paste.ofcode.org/fEiy8E82mWPFLbKnbivy25

ReplyDelete