I have a grayscale image,
the dominant colors in the background are shades of white and light gray, I have tried using otsu binarization but it gave no good results, so I decided according to the histogram below to write manually:
img_gray[img_gray > 130] = 255
so all white/gray shades have been converted to white. it worked impressively well, I was wondering is there an efficient way getting this threshold without re-inventing the wheel, I know I can apply: np.bincount(img_gray.ravel()) and try to find the beginning of the ramp before the peak.
Important fact to say is:
The images' characteristics are there will be always two peaks, the first will reside between 0 to 50 (it's the small one) and the other somewhere in the light white shades.
Is there an approach to find this threshold?
Thank you all