Content deleted Content added
AdvikaKharat (talk | contribs) Added another Edge Detection approach, namely, The Marr-Hildreth Edge Detector. Cited the respective textbook and linked the corresponding Wikipedia article. |
Added code for Edge detection using Prewitt, Scharr and Sobel Operator. |
||
Line 278:
=== The Marr-Hildreth Edge Detector ===
[[Marr–Hildreth algorithm|The Marr-Hildreth edge detector]]<ref>{{Cite book |last=Gonzalez |first=Rafael |title=Digital Image Processing |publisher=Pearson Education |year=2018 |isbn=978-0-13-335672-4 |edition=4th}}</ref> is distinguished by its use of the Laplacian of Gaussian (LoG) operator for edge detection in digital images. Unlike other edge detection methods, the LoG approach combines Gaussian smoothing with second derivative operations, allowing for simultaneous noise reduction and edge enhancement. The key advantage of this method lies in its ability to detect edges at various scales by adjusting the standard deviation of the Gaussian kernel, enabling detection of fine details as well as broader transitions. Moreover, the technique leverages zero-crossing detection on the LoG response to precisely locate edges, offering robustness against noise and maintaining edge continuity. This approach is particularly effective for detecting edges with clear boundaries in images while minimizing false positives due to noise, making it a valuable tool in computer vision applications where accurate edge localization is crucial.
== Code for Edge Detection using Prewitt, Scharr and Sobel Operator<ref>{{Cite web |date=2021-10-11 |title=Edge detection using Prewitt, Scharr and Sobel Operator |url=https://www.geeksforgeeks.org/edge-detection-using-prewitt-scharr-and-sobel-operator/ |access-date=2024-05-08 |website=GeeksforGeeks |language=en-US}}</ref> ==
=== Edge Detection using Prewitt Operator ===
<syntaxhighlight lang="matlab" line="1">
% MATLAB code for prewitt
% operator edge detection
k=imread("logo.png");
k=rgb2gray(k);
k1=double(k);
p_msk=[-1 0 1; -1 0 1; -1 0 1];
kx=conv2(k1, p_msk, 'same');
ky=conv2(k1, p_msk', 'same');
ked=sqrt(kx.^2 + ky.^2);
% display the images.
imtool(k,[]);
% display the edge detection along x-axis.
imtool(abs(kx), []);
% display the edge detection along y-axis.
imtool(abs(ky),[]);
% display the full edge detection.
imtool(abs(ked),[]);
</syntaxhighlight>
=== Edge Detection using Scharr Operator ===
<syntaxhighlight lang="matlab" line="1">
%Scharr operator -> edge detection
k=imread("logo.png");
k=rgb2gray(k);
k1=double(k);
s_msk=[-3 0 3; -10 0 10; -3 0 3];
kx=conv2(k1, s_msk, 'same');
ky=conv2(k1, s_msk', 'same');
ked=sqrt(kx.^2 + ky.^2);
%display the images.
imtool(k,[]);
%display the edge detection along x-axis.
imtool(abs(kx), []);
%display the edge detection along y-axis.
imtool(abs(ky),[]);
%display the full edge detection.
imtool(abs(ked),[]);
</syntaxhighlight>
=== Edge Detection using Sobel Operator ===
<syntaxhighlight lang="matlab" line="1">
% MATLAB code for Sobel operator
% edge detection
k=imread("logo.png");
k=rgb2gray(k);
k1=double(k);
s_msk=[-1 0 1; -2 0 2; -1 0 1];
kx=conv2(k1, s_msk, 'same');
ky=conv2(k1, s_msk', 'same');
ked=sqrt(kx.^2 + ky.^2);
%display the images.
imtool(k,[]);
%display the edge detection along x-axis.
imtool(abs(kx), []);
%display the edge detection along y-axis.
imtool(abs(ky),[]);
%display the full edge detection.
imtool(abs(ked),[]);
</syntaxhighlight>
==See also==
|