title: Convert all Grayscale pixel value to black
body: <p>I am calculating the histogram of a gray scale image and i want to convert the range of grayscale pixel to black. I am using the following code to retrieve the histogram.`</p>
  
  <pre><code>image = cv2.imread('./images/test/image_5352.jpg')
  cv2.imshow("image", image)
  gray = cv2.cvtColor(image, cv2.COLOR_BGR2GRAY)
  cv2.imshow("gray", gray)
  
  hist = cv2.calcHist([gray], [0], None, [256], [0, 256])
  plt.figure()
  plt.title("Grayscale Histogram")
  plt.xlabel("Bins")
  plt.ylabel("# of Pixels")
  plt.plot(hist)
  plt.xlim([0, 256])
  key = cv2.waitKey(0)
  cv2.destroyAllWindows()
  </code></pre>
  
  <p><a href="https://i.stack.imgur.com/J5Xqf.png" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/J5Xqf.png" alt="Histogram of the image"></a></p>
  
  <p>For example i want to convert all the pixels with value of 50 to black.</p>