Categories
Assignments

Tutorial Assignment

Author: Zhihan Yang

Introduction

Two weeks ago, I read about a tool that can extract the main colors from (photos of) paintings. This tool uses the k-means algorithm to group pixels into a user-specified number of major colors. A painting can easily contain millions of different colors; this tool reduces this number into a manageable domain, allowing additional analysis to be performed (e.g., how an artist’s color preference changes over time). In addition, when you replace each pixel with the major color it belongs to, you create abstractness. This style of art is called Image Compression Art. Unfortunately, the tool is not free and I can’t find it anymore – I saw it on a random blog. Nevertheless, I managed to re-create a similar one in Python. I recorded the the tutorial video below as a walkthrough of my Python program and its outputs. I hope this can help art students who would like to re-think the relationship between art and computer algorithms:

Video tutorial

Note to Austin: YouTube only gives high-quality streaming options after the video has been uploaded for around 12 hours. If the quality of this video is low, please come back to it later. Thanks!

Note to everyone: The video starts off with the timestamp of the output of my program.

References

Scikit-learn’s k-means documentation: https://scikit-learn.org/stable/modules/generated/sklearn.cluster.KMeans.html

A tutorial on the k-means algorithm that I enjoyed: https://mubaris.com/posts/kmeans-clustering/

2 replies on “Tutorial Assignment”

Zhihan, this is an amazing tutorial. You chose such an interesting topic. (Do you have any experience in linear algebra? I ask because apparently matrixes can also be used for image compression. I have never programmed anything to do that myself, though.)

I don’t really have a “use” for this type of image sampling right now, but this looks so fun that I want to try it anyway!

I have taken linear algebra at Carleton; this algorithm is actually more of a clustering algorithm. Anyways, thanks for the comment!

Leave a Reply

Your email address will not be published. Required fields are marked *

css.php