Skip to content

This repository implements K-Means clustering for color quantization in images, running on CPU. The program reduces the number of colors in an image while maintaining visual quality, making it useful for compression and artistic effects.

Notifications You must be signed in to change notification settings

The-Silly-Glitch/Color-Quantization-using-K-means-Clustering

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

9 Commits
 
 
 
 
 
 

Repository files navigation

K-Means Color Quantization

This project implements K-Means Clustering for color quantization in images, allowing you to reduce the number of colors while preserving visual quality. The implementation is currently in NumPy, and a CUDA-accelerated version is in progress.

Features

  • Perform K-Means clustering on images to reduce colors.
  • Adjustable number of clusters (K).
  • Supports custom images via GUI.
  • Tracks execution time for performance evaluation.
  • CUDA acceleration (WIP) to improve performance on large images.

Installation

1. Clone the Repository

git clone https://github.com/The-Silly-Glitch/Color-Quantization-using-K-means-Clustering.git
cd Color-Quantization-using-K-means-Clustering

Usage

Run the GUI

python main.py
  • Load an image.
  • Set the number of clusters (K).
  • Click Quantize to apply K-Means color reduction.

Example Output

Original Image Quantized Image (K=10)
Original Quantized

CUDA Acceleration (WIP)

  • The CUDA implementation is under development using CuPy.
  • Future improvements include faster distance calculations and parallel K-Means iterations.

About

This repository implements K-Means clustering for color quantization in images, running on CPU. The program reduces the number of colors in an image while maintaining visual quality, making it useful for compression and artistic effects.

Topics

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages