I have plotted the following graph from a binary image which has only data value of 0 and 255. So, far I have used the following:
pic = cv2.imread("img.png")
pic = pic[:,:,0] #taking just one channel
count_non_zero = np.sum(pic==255, axis = 1)
plt.plot(count_non_zero)
That gives me the following graph where the x axis is the number of row, y axis is the number of columns and data points being the pixel values of 0 and 255:
Graph:
Now, I am trying to print out the local maximum of each peaks sequentially (colored in black). This value is the number of columns where each peak is hitting. For that graph, it should print out 3 peak values around 590~600. Kindly please help me!
Been stuck here for a while now!