I am doing a project on image binarisation where I am required to transform an image such that its divided into individual color layers using clustering. What I mean to say is that there will be no shades in the image, instead the shades of the input image will be converted into a layer dividing the two colors.
The input and output images are given:
I am trying to implement this using opencv, but not able to figure out how to do that. Thanks in advance.