3 ms·
I wrote some similar code in python recently -- I think color visualizations like this are both fun and potentially useful for certain image manipulations. Thi
by tylerneylon 15y ago
I wrote some similar code in python recently -- I think color visualizations like this are both fun and potentially useful for certain image manipulations.
This includes a readable 36-line implementation of k-means clustering that could be shorter if one wanted to play some code golf :) I used a pie chart layout, with pie slices proportional to their corresponding cluster sizes.
Code:
https://github.com/tylerneylon/imghist/blob/master/imghist.py https://github.com/tylerneylon/imghist/blob/master/imghist.p...
Sample images:
http://blog.zillabyte.com/post/11193458776/color-as-data http://blog.zillabyte.com/post/11193458776/color-as-data
http://blog.zillabyte.com/post/13141231882/hue-histograms http://blog.zillabyte.com/post/13141231882/hue-histograms
If anyone else is interested in this stuff, Austin A made a great suggestion on the original post to use the Lab colorspace.