Western University of Santa Catarina - UNOESC - Chapecó
Graduation Course in Computer Science
Work: Comparison Between Image Quantization Algorithms
Academic: Saulo Popov Zambiasi
Advisor: Marcos Vinícius Rayol Sobreiro
This project is the result of my Final Work for the Graduation Course in Computer Science at UNOESC - Chapecó in 1998. I conducted a comparative study of several color image quantization algorithms. Quantization is the process of representing an image with M colors by another with N colors, where N < M.
The algorithms were implemented in the C programming language, and both visual and numerical results were used for comparison in the monograph. The chosen algorithms were:
- Quantization by Recursive Subdivision (Mid Cut)
- Octree Quantization
- Quantization by Double Clusters
The source code was updated to be uploaded to GitHub. Originally, a proprietary graphics library was used for image I/O, which I replaced with the SDL2 library. I also translated comments, function names, and various variables into English. The program remains as a single file, as in the original version, which was my first project in C.
There may still be some bugs in the code. If you find any, feel free to send suggestions for corrections.
- SDL2
- SDL2_image
- clang++ or g++
To compile the project, simply run:
makeTo clean the build:
make cleanThis program transforms an image from N colors to M colors (N > M), measuring the elapsed time. Three color image quantization algorithms are available.
Usage:
quant <img1.ext> <img2.ext> <colors> <algorithm>img1.ext- Original image with N colors.img2.ext- Resulting image with M colors (N > M).colors- Number of colors inimg2.ext.algorithm- Quantization algorithm:0- Recursive Subdivision1- Octree2- Double Clusters
Example:
quant image.png result.png 256 0The algorithms implemented in this project are not my own inventions. I implemented them based on descriptions from academic literature and other sources, solely for the purpose of comparison and study. The original references for each algorithm can be found in the accompanying PDF monograph.
At the time, I wanted to work with digital games for my Final Work, but I couldn't find an advisor available for that. I found an advisor in Computer Graphics, and I am very grateful to Marcos, who guided me even from a distance, as he lived in Rio de Janeiro while I attended university in Chapecó.
