Image Compression with Clustering: What I learned
TL;DR: I used K-means to shrink images by grouping similar colors, and it turns out you don’t need many colors to keep an image looking good (and some choices run a lot faster than others). This post focuses on intuition and observations rather than implementation details, out of respect for academic integrity and future students. Why This Was Interesting In one of my Computational Data Analysis (CDA) homework assignments, I explored how a classic idea from data science: clustering can be used for image compression . A digital color image is made up of millions of pixels , and each pixel has three numbers describing its Red, Green, and Blue ( RGB ) values. The key idea behind this homework is simple: Instead of storing every exact color , we can group similar colors together and represent them with a smaller set of “representative” colors. This is exactly what K-means clustering does. Each pixel is treated as a point in color space Similar colors are group...