Non-maximum suppression is a technique used in edge detection to thin out an edge in regions where the pixel intensity magnitude is not as strong as it should be. In MATLAB, there is a built-in function called nonmaxsup
that can be used to perform non-maximum suppression on an image.
The function takes two inputs - the first input is the gradient magnitude image, and the second input is the gradient direction image. The output is a binary edge map where the edges have been thinned out by suppressing non-maximum pixels.
Here is an example usage of the nonmaxsup
function:
main.m365 chars12 lines
In this example, we first read in an image and perform edge detection using the imgradientxy
and imgradient
functions. We then pass the gradient magnitude and direction images to the nonmaxsup
function to thin out the edges. Finally, we display the original image and the resulting edge map after non-maximum suppression using the imshow
function.
gistlibby LogSnag