thobbs / color-clustering

A tool to perform K-means clustering analysis of the colors in an image.

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

color-clustering

A python script to analyze the colors in an image through K-means clustering. The script creates an output file displaying the main colors used with sizes proportional to their use and HSV values for each color.

The HSV values in the output use the following ranges:

  • Hue: [0, 360]
  • Saturation: [0, 100]
  • Value: [0, 100]

Example Output

This is an analysis of Van Gogh's The Pink Peach Tree

image

image

And an analysis of J.M.W. Turner's Ulysses deriding Polyphemus

image

image

Usage

./color_clustering.py <imagefile> [--kmeans=32] [--rounds=10] [--size=1000] [--file]

You can use the --help option for more details.

Dependencies

  • matplotlib
  • numpy
  • scipy
  • PIL

License

Apache 2.0 License

About

A tool to perform K-means clustering analysis of the colors in an image.

License:Apache License 2.0


Languages

Language:Python 100.0%