Trying on the photos above, we see an instance of a picture posterization filter that provides photos a cartoon-like look, however behind the scenes, this filter is definitely utilizing a machine studying algorithm often called clustering.
Earlier than exploring into how this course of works and seeing how we will implement it in Python, let’s check out why we’d wish to do that within the first place.
Picture Segmentation
In a standard {photograph}, a pixel can take one in all roughly 16.7 million totally different colors. On this processed picture, nevertheless, there are solely 5 totally different colors. We’ve cut up all the pixels into 5 totally different teams, segmenting the picture into these totally different colour-regions.
We’ve additionally lower down on the quantity of noise and variation inside the picture. So, if this had been for use in another machine studying software, we’ve simply massively decreased the quantity of knowledge that must be processed, particularly if this had been utilized to an entire library of photos.
Though we’ve simplified this picture, we’ve nonetheless retained a lot of the necessary structural knowledge. We’re nonetheless capable of determine shapes and kinds, shadows and…