Skip to content

This Processing sketch demonstrates K-means clustering for visual abstraction of images. It allows users to interactively adjust the number of clusters and toggle pixel sorting within clusters.

License

Notifications You must be signed in to change notification settings

MichailSemoglou/k-means-clustering-sketch

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

4 Commits
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

K-means Clustering for Visual Abstraction

This Processing sketch demonstrates K-means clustering for visual abstraction of images. It allows users to interactively adjust the number of clusters and toggle pixel sorting within clusters.

Features

  • K-means clustering for image abstraction
  • Interactive slider to adjust the number of clusters (k)
  • Option to sort pixels within clusters based on brightness
  • Real-time visualization of clustering results

Requirements

Setup

  1. Clone this repository or download the sketch files.
  2. Open the k_means_clustering_sketch.pde file in Processing.
  3. Place your input image (named IMG_5748_1080x1080.png) in the data/ folder.
  4. Run the sketch.

Usage

  • Use the slider at the bottom of the window to adjust the number of clusters (k).
  • Press “S” or “s” to toggle pixel sorting within clusters.

Files

  • k_means_clustering_sketch.pde: Main sketch file containing the K-means clustering implementation and visualization code.
  • Slider.pde: Class file for the interactive slider used to adjust the number of clusters.
  • data/IMG_5748_1080x1080.png: Sample input image (replace with your own image).

License

This project is open-source and available under the MIT License.

About

This Processing sketch demonstrates K-means clustering for visual abstraction of images. It allows users to interactively adjust the number of clusters and toggle pixel sorting within clusters.

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published