The Wayback Machine - https://web.archive.org/web/20200914164151/https://github.com/Aftaab99/ImageColorQuantization
Skip to content
master
Go to file
Code

Latest commit

 

Git stats

Files

Permalink
Failed to load latest commit information.
Type
Name
Latest commit message
Commit time
 
 
 
 
 
 

README.md

Image Compression/Color Quantization using K-Means

Implemented K-Means algorithm from scratch in C++ for compressing a RGB image into another image having the K most dominant colours. Used opencv for Image reading and processing.

Make sure you have opencv C++ installed, then run,

g++ KMeansCompressv2.cc -o output `pkg-config --libs opencv`
./output rain_princess.png rain_princess_compressed.png 16

Command line arguments are <input_file_path> <output_file_path> <n color vectors> .

PNG format recommended, JPEG actually increases file size in some cases(which I think is due to the nature of the format and the fact that we are saving with 100% quality).

Example images

Original Image Compressed Image, with 16 colours

About

Implementation of K-Means algorithm from scratch in C++ for image compression/color quantization

Topics

Resources

License

Releases

No releases published

Packages

No packages published

Languages

You can’t perform that action at this time.