Art & Intelligence
Human Sight¶
Over
99%
of humanity can see one million different shades of color.
1%
of us are gifted with a fourth photoreceptor cone, and can see 100 million colors.
We have an amazing ability to distinguish between subtle color tones.
But the human brain evolved to simplify the chaotic world around us, and to categorize and group what we see - including colors.
Rather than describing the sky above us as the tapestry of shades that it is, we instead say that the sky is blue.
Likewise with autumn leaves, which take on thousands and thousands of colors – we instead say brown, orange, and yellow.
The human experience of color is, in fact, a clustering algorithm.¶
And teaching a machine to emulate this approach can be accomplished in many ways.
And one of these is three-dimensional K-Means clustering.
Let's teach a machine to do exactly that.¶
import binascii
import matplotlib.pyplot as plt
import numpy as np
import pandas as pd
from PIL import Image
import scipy.cluster
import scipy.stats as ss
First...¶
We'll extract every pixel from an image, and access each one's RGB values.
im = Image.open('image.jpg')
im