Full-time web dev; JS lover since 2002; CSS fanatic. #CSSIsAwesome
I try to stay up with new web platform features. Web feature you don't understand? Tell me! I'll write an article!
He/him
Yeah, basically. We looked for centroids based on the three color channels, so the average Red, Green, and Blue values within each cluster. Then once the centroids converged and stopped shifting around, we rendered a new version of the image with each pixel replaced by the centroid value of its cluster. So essentially you compress the image by reducing it down to only k unique colors. So yes, it's definitely a lossy compression.
I was very surprised at how recognizable the pictures were even with k=5. I mean, it's very clearly compressed, but it still looks surprisingly good. Bump it up to k=16 or k=24 and it'll definitely take a lot longer to run, but the output is very nice.
For further actions, you may consider blocking this person and/or reporting abuse
We're a place where coders share, stay up-to-date and grow their careers.
Yeah, basically. We looked for centroids based on the three color channels, so the average Red, Green, and Blue values within each cluster. Then once the centroids converged and stopped shifting around, we rendered a new version of the image with each pixel replaced by the centroid value of its cluster. So essentially you compress the image by reducing it down to only
k
unique colors. So yes, it's definitely a lossy compression.I was very surprised at how recognizable the pictures were even with
k=5
. I mean, it's very clearly compressed, but it still looks surprisingly good. Bump it up tok=16
ork=24
and it'll definitely take a lot longer to run, but the output is very nice.