title: Find the centre value of the two highest peaks in a histogram Python
body: <p>I am trying to find the 'middle' value between the highest and second highest peak in a histogram. I can do this manually of course but I want to create an automated method. To calculate my histogram I use:</p>
  
  <pre><code>hist= cv2.calcHist([gray_scale_img], [0], None, [256], [0, 256])
  </code></pre>
  
  <p>so far I have only figured out how to work out the maximum peak value using <code>max = np.argmax(hist)</code>. I have attached an image the red is what I am aiming to find.
  <a href="https://i.stack.imgur.com/GtbmV.jpg" rel="nofollow noreferrer">HISTOGRAM IMAGE</a></p>