Non-maximum suppression is a technique used in edge detection to simplify the output by getting rid of non-essential pixels. Here's how you can implement non-maximum suppression from scratch in Matlab:
1604 chars48 lines
Here, we compute the magnitude of the input image by taking the absolute value of the real and imaginary components of the input matrix. We also convert the orientation from radians to degrees, and then divide the degrees by 45 to form 4 categories, which correspond to the four main directions (horizontal, vertical, and the two diagonals). We then iterate through each pixel in the input image and compute the weighted average of the adjacent pixels in the direction of the current pixel. Finally, we check whether the magnitude of the current pixel is greater than both weighted averages, and output a binary matrix where the edge pixels have a value of 1 and all other pixels are 0.
gistlibby LogSnag