Do you happen to have a 1D non-maximum suppression algorithm written in Python. I need it for making a Canny edge detector in Python using scipy that takes as input a 1D intensity vector.
I've looked around on the web and there is a lot of information describing the behavior of the Canny edge detector and some examples written in Java but they all describe edge detection in 2D.
However scipy does support the other algorithms needed for the Canny edge detection, namely the Gaussian filtering and differentiation for 1D.
Thanks in advance.
Non Maximum Suppression is a computer vision method that selects a single entity out of many overlapping entities (for example bounding boxes in object detection). The criteria is usually discarding entities that are below a given probability bound.
June 2, 2021 By Leave a Comment. Non Maximum Suppression (NMS) is a technique used in numerous computer vision tasks. It is a class of algorithms to select one entity (e.g., bounding boxes) out of many overlapping entities.
Non-maximum supression is often used along with edge detection algorithms. The image is scanned along the image gradient direction, and if pixels are not part of the local maxima they are set to zero. This has the effect of supressing all image information that is not part of local maxima.
Do you just mean a maximum filter? If so, have a look at scipy.ndimage.maximum_filter1d
As a quick example:
import numpy as np
import scipy.ndimage as ndimage
input = np.sin(np.linspace(0, 4*np.pi, 20))
input = (input * 10).astype(np.int) # Makes it easier to read
output = ndimage.maximum_filter1d(input, 4)
print 'In: ', input
print 'Out:', output
This yields:
In: [ 0 6 9 9 4 -1 -7 -9 -8 -3 3 8 9 7 1 -4 -9 -9 -6 0]
Out: [ 6 9 9 9 9 9 4 -1 -3 3 8 9 9 9 9 7 1 -4 0 0]
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With