void Laplacian(InputArray src, OutputArray dst, int ddepth, int ksize=1, double scale=1, double delta=0, int borderType=BORDER_DEFAULT )
Parameters:
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
ReplyDeletewhere did we find the zero crossing
ReplyDeleteapplets for java to learning java
ReplyDeleteappvn download
ReplyDeletetutuapp apk ios
It was such a great article.Thanks for sharing.
ReplyDeleteHadoop interview questions and answers
Hadoop interview questions
Hadoop interview questions and answers online
Hadoop interview questions and answers pdf
Hadoop interview questions techtutorial
How to fix this error?
ReplyDelete"Traceback (most recent call last):
File "C:/Documents/Python Programs/Laplacian.py", line 7, in
laplacian = cv2.Laplacian(img,cv2.CV_64F)
cv2.error: OpenCV(4.1.0) C:\projects\opencv-python\opencv\modules\core\src\matrix.cpp:757: error: (-215:Assertion failed) dims <= 2 && step[0] > 0 in function 'cv::Mat::locateROI'"
ReplyDeleteالحشرات الضارة هي الحشرات التي تلحق الضرر بالإنسان وممتلكاتهم ومحاصيلهم ومواشيهم ، وتنتشر في جميع أنحاء العالم ، وقد تسبب الحشرات أضرارًا مباشرة ، أي بامتصاص دماء الكائنات الحية ، أو أكل أنسجتها ، أو بشكل غير مباشر ، عن طريق إزالتها. تنتقل مسببات الأمراض أو الطفيليات إلى الكائنات الحية ، وغالبًا ما يكون الضرر هو البالغين. وأحيانًا يكون الضرر في البالغين ويرقاتهم. قد تعمل هذه الحشرات بمفردها أو قد تهاجم في مجموعات. في أي حال ، يجب مكافحة الآفات والقضاء عليها لتجنب التسبب في ضرر
شركة ارمور للخدمات المنزلية