I'm trying to detect peaks with a certain prominence using the scipy.signal.find_peaks method with its prominence parameter. But the method seems to only detect certain peaks that fulfill the condition but not all of them. The signal and detected peaks(red crosses) are shown in the image. I have encircled a peak that fulfills the condition according to my understanding but isn't detected by the find_peaks method. Can someone explain to me if I just misunderstand the concept of prominence or what the problem could be?
This is the code that I used for detecting the peaks:
# load image file and apply blur filter
image = cv2.imread(file)
gray = cv2.cvtColor(image, cv2.COLOR_BGR2GRAY)
blur = cv2.bilateralFilter(gray,9,75,75)
# detect edges in grayscale value for one horizontal line
peaks,_ = signal.find_peaks(-blur[200,:], prominence=20)
plt.plot(-blur[200,:])
plt.plot(peaks,-blur[200,:][peaks],'rx')
plt.show()
I would expect that the encircled peak would also fulfill the prominence parameter, because the reference would be the lowest value between the peak and the left border of the signal.