title: OpenCV Dynamic segmentation method for blurred or degraded image
body: <p>I have implemented segmentation for given images, but images may vary based on different color. How can I separate background from the foreground where foreground contains hollow circle/filled circle only. My goal is to find threshold value automatically based on color of image.
  [Sample images][1]</p>
  
  <pre><code>import numpy as np
  import cv2
  import os
  
  image =cv2.imread("cropped2/pnr6.jpg")
  img = image.copy()
  MARKER_LOWER_BOUND = ( 0,  0,  0)
  MARKER_UPPER_BOUND = (255, 255, 25)
  marker_seg_mask = cv2.inRange(img, MARKER_LOWER_BOUND, MARKER_UPPER_BOUND)
  cv2.imshow("thresold.jpg",marker_seg_mask)
  </code></pre>