You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

483 lines
1.1 MiB

2 years ago
{
"cells": [
{
"cell_type": "markdown",
"metadata": {},
"source": [
"___\n",
"\n",
"<a href='http://www.pieriandata.com'><img src='../Pierian_Data_Logo.png'/></a>\n",
"___\n",
"<center><em>Copyright by Pierian Data Inc.</em></center>\n",
"<center><em>For more information, visit us at <a href='http://www.pieriandata.com'>www.pieriandata.com</a></em></center>"
]
},
{
"cell_type": "markdown",
"metadata": {},
"source": [
"# K Means Color Quantization"
]
},
{
"cell_type": "markdown",
"metadata": {},
"source": [
"### Imports\n"
]
},
{
"cell_type": "code",
"execution_count": 3,
"metadata": {},
"outputs": [],
"source": [
"import numpy as np\n",
"\n",
"import matplotlib.image as mpimg\n",
"import matplotlib.pyplot as plt"
]
},
{
"cell_type": "markdown",
"metadata": {},
"source": [
"### The Image"
]
},
{
"cell_type": "code",
"execution_count": 6,
"metadata": {},
"outputs": [],
"source": [
"image_as_array = mpimg.imread('../DATA/palm_trees.jpg')"
]
},
{
"cell_type": "code",
"execution_count": 8,
"metadata": {},
"outputs": [
{
"data": {
"text/plain": [
"array([[[ 25, 89, 127],\n",
" [ 25, 89, 127],\n",
" [ 25, 89, 127],\n",
" ...,\n",
" [ 23, 63, 98],\n",
" [ 51, 91, 127],\n",
" [ 50, 90, 126]],\n",
"\n",
" [[ 25, 89, 127],\n",
" [ 25, 89, 127],\n",
" [ 25, 89, 127],\n",
" ...,\n",
" [ 31, 71, 106],\n",
" [ 48, 88, 124],\n",
" [ 47, 90, 125]],\n",
"\n",
" [[ 25, 89, 127],\n",
" [ 25, 89, 127],\n",
" [ 25, 89, 127],\n",
" ...,\n",
" [ 39, 79, 114],\n",
" [ 42, 85, 120],\n",
" [ 44, 88, 123]],\n",
"\n",
" ...,\n",
"\n",
" [[ 4, 4, 6],\n",
" [ 4, 4, 6],\n",
" [ 4, 4, 6],\n",
" ...,\n",
" [ 9, 9, 11],\n",
" [ 9, 9, 11],\n",
" [ 9, 9, 11]],\n",
"\n",
" [[ 3, 3, 5],\n",
" [ 3, 3, 5],\n",
" [ 3, 3, 5],\n",
" ...,\n",
" [ 8, 8, 10],\n",
" [ 8, 8, 10],\n",
" [ 8, 8, 10]],\n",
"\n",
" [[ 4, 4, 6],\n",
" [ 4, 4, 6],\n",
" [ 4, 4, 6],\n",
" ...,\n",
" [ 9, 9, 11],\n",
" [ 10, 10, 12],\n",
" [ 10, 10, 12]]], dtype=uint8)"
]
},
"execution_count": 8,
"metadata": {},
"output_type": "execute_result"
}
],
"source": [
"image_as_array # RGB CODES FOR EACH PIXEL"
]
},
{
"cell_type": "code",
"execution_count": 12,
"metadata": {},
"outputs": [
{
"data": {
"text/plain": [
"<matplotlib.image.AxesImage at 0x16d48ff0eb0>"
]
},
"execution_count": 12,
"metadata": {},
"output_type": "execute_result"
},
{
"data": {
"image/png": "iVBORw0KGgoAAAANSUhEUgAAAt4AAAPsCAYAAAByUbtNAAAAOXRFWHRTb2Z0d2FyZQBNYXRwbG90bGliIHZlcnNpb24zLjMuMiwgaHR0cHM6Ly9tYXRwbG90bGliLm9yZy8vihELAAAACXBIWXMAAB7CAAAewgFu0HU+AAEAAElEQVR4nOz9SYwkyZauiX0iopPNZj67x5wROd6p7r01vKrqLvYj2b1pEOCOXBEgOIA7AiQaBHfkhgQe0CC47BUBguCaADcP3eCr96pejXe+OcY8++xus5lOIsKFqJmbe7hHRmRmRGbe0j9g4TaoqYmqior8cs5/zhHWWkqUKFGiRIkSJUqUKPFmIb/tBpQoUaJEiRIlSpQo8S8BJfEuUaJEiRIlSpQoUeItoCTeJUqUKFGiRIkSJUq8BZTEu0SJEiVKlChRokSJt4CSeJcoUaJEiRIlSpQo8RZQEu8SJUqUKFGiRIkSJd4CSuJdokSJEiVKlChRosRbQEm8S5QoUaJEiRIlSpR4CyiJd4kSJUqUKFGiRIkSbwEl8S5RokSJEiVKlChR4i2gJN4lSpQoUaJEiRIlSrwFlMS7RIkSJUqUKFG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LjQ1qdFt2DHZaXVsEPqTY79HZ3WWmv0Kk3GRwc0WqvcHx4yNb6Gn5Yp7EEo2nCzqO79A/3CZvLkKUoY5ikGbXimMRM5jRrtnATj7PznHPkX5eLz7iYteg8RwiBxhaDeM502AdjqFRrjPvHJDEsLa+Bmdm2z/ECibfDQq01BfkWSDnrp4ur54tJppXCnVOjCYTBTAfsP3vA8dN7TPqH5JMhEg1WYzGO0DujOAZ
"text/plain": [
"<Figure size 1200x1200 with 1 Axes>"
]
},
"metadata": {
"needs_background": "light"
},
"output_type": "display_data"
}
],
"source": [
"plt.figure(figsize=(6,6),dpi=200)\n",
"plt.imshow(image_as_array)"
]
},
{
"cell_type": "markdown",
"metadata": {},
"source": [
"## Using Kmeans to Quantize Colors\n",
"\n",
"Quantizing colors means we'll reduce the number of unique colors here to K unique colors. Let's try just 6 colors!"
]
},
{
"cell_type": "code",
"execution_count": 42,
"metadata": {},
"outputs": [
{
"data": {
"text/plain": [
"(1401, 934, 3)"
]
},
"execution_count": 42,
"metadata": {},
"output_type": "execute_result"
}
],
"source": [
"image_as_array.shape\n",
"# (w,h,3 color channels)"
]
},
{
"cell_type": "markdown",
"metadata": {},
"source": [
"### Convert from 3d to 2d\n",
"\n",
"Kmeans is designed to train on 2D data (data rows and feature columns), so we can reshape the above strip by using (w,h,c) ---> (w * h,c)"
]
},
{
"cell_type": "code",
"execution_count": 43,
"metadata": {},
"outputs": [],
"source": [
"(w,h,c) = image_as_array.shape"
]
},
{
"cell_type": "code",
"execution_count": 44,
"metadata": {},
"outputs": [],
"source": [
"image_as_array2d = image_as_array.reshape(w*h,c)"
]
},
{
"cell_type": "code",
"execution_count": 45,
"metadata": {},
"outputs": [],
"source": [
"from sklearn.cluster import KMeans"
]
},
{
"cell_type": "code",
"execution_count": 46,
"metadata": {},
"outputs": [],
"source": [
"model = KMeans(n_clusters=6)"
]
},
{
"cell_type": "code",
"execution_count": 47,
"metadata": {},
"outputs": [
{
"data": {
"text/plain": [
"KMeans(n_clusters=6)"
]
},
"execution_count": 47,
"metadata": {},
"output_type": "execute_result"
}
],
"source": [
"model"
]
},
{
"cell_type": "code",
"execution_count": 62,
"metadata": {},
"outputs": [],
"source": [
"labels = model.fit_predict(image_as_array2d)"
]
},
{
"cell_type": "code",
"execution_count": 63,
"metadata": {},
"outputs": [
{
"data": {
"text/plain": [
"array([3, 3, 3, ..., 0, 0, 0])"
]
},
"execution_count": 63,
"metadata": {},
"output_type": "execute_result"
}
],
"source": [
"labels"
]
},
{
"cell_type": "code",
"execution_count": 73,
"metadata": {},
"outputs": [
{
"data": {
"text/plain": [
"array([[ 2.78511649, 2.58768262, 3.70018933],\n",
" [138.48117295, 144.26702702, 143.36832053],\n",
" [193.42381114, 154.48097123, 107.32286981],\n",
" [ 71.66897867, 109.55660624, 137.71325107],\n",
" [219.38959087, 134.67545907, 45.42786667],\n",
" [ 67.69383456, 61.88876822, 62.08150368]])"
]
},
"execution_count": 73,
"metadata": {},
"output_type": "execute_result"
}
],
"source": [
"# THESE ARE THE 6 RGB COLOR CODES!\n",
"model.cluster_centers_"
]
},
{
"cell_type": "code",
"execution_count": 74,
"metadata": {},
"outputs": [],
"source": [
"rgb_codes = model.cluster_centers_.round(0).astype(int)"
]
},
{
"cell_type": "code",
"execution_count": 75,
"metadata": {},
"outputs": [
{
"data": {
"text/plain": [
"array([[ 3, 3, 4],\n",
" [138, 144, 143],\n",
" [193, 154, 107],\n",
" [ 72, 110, 138],\n",
" [219, 135, 45],\n",
" [ 68, 62, 62]])"
]
},
"execution_count": 75,
"metadata": {},
"output_type": "execute_result"
}
],
"source": [
"rgb_codes"
]
},
{
"cell_type": "code",
"execution_count": 76,
"metadata": {},
"outputs": [],
"source": [
"quantized_image = np.reshape(rgb_codes[labels], (w, h, c))"
]
},
{
"cell_type": "code",
"execution_count": 77,
"metadata": {},
"outputs": [
{
"data": {
"text/plain": [
"array([[[ 72, 110, 138],\n",
" [ 72, 110, 138],\n",
" [ 72, 110, 138],\n",
" ...,\n",
" [ 68, 62, 62],\n",
" [ 72, 110, 138],\n",
" [ 72, 110, 138]],\n",
"\n",
" [[ 72, 110, 138],\n",
" [ 72, 110, 138],\n",
" [ 72, 110, 138],\n",
" ...,\n",
" [ 68, 62, 62],\n",
" [ 72, 110, 138],\n",
" [ 72, 110, 138]],\n",
"\n",
" [[ 72, 110, 138],\n",
" [ 72, 110, 138],\n",
" [ 72, 110, 138],\n",
" ...,\n",
" [ 72, 110, 138],\n",
" [ 72, 110, 138],\n",
" [ 72, 110, 138]],\n",
"\n",
" ...,\n",
"\n",
" [[ 3, 3, 4],\n",
" [ 3, 3, 4],\n",
" [ 3, 3, 4],\n",
" ...,\n",
" [ 3, 3, 4],\n",
" [ 3, 3, 4],\n",
" [ 3, 3, 4]],\n",
"\n",
" [[ 3, 3, 4],\n",
" [ 3, 3, 4],\n",
" [ 3, 3, 4],\n",
" ...,\n",
" [ 3, 3, 4],\n",
" [ 3, 3, 4],\n",
" [ 3, 3, 4]],\n",
"\n",
" [[ 3, 3, 4],\n",
" [ 3, 3, 4],\n",
" [ 3, 3, 4],\n",
" ...,\n",
" [ 3, 3, 4],\n",
" [ 3, 3, 4],\n",
" [ 3, 3, 4]]])"
]
},
"execution_count": 77,
"metadata": {},
"output_type": "execute_result"
}
],
"source": [
"quantized_image"
]
},
{
"cell_type": "code",
"execution_count": 79,
"metadata": {},
"outputs": [
{
"data": {
"text/plain": [
"<matplotlib.image.AxesImage at 0x16d5bd928b0>"
]
},
"execution_count": 79,
"metadata": {},
"output_type": "execute_result"
},
{
"data": {
"image/png": "iVBORw0KGgoAAAANSUhEUgAAAt4AAAPsCAYAAAByUbtNAAAAOXRFWHRTb2Z0d2FyZQBNYXRwbG90bGliIHZlcnNpb24zLjMuMiwgaHR0cHM6Ly9tYXRwbG90bGliLm9yZy8vihELAAAACXBIWXMAAB7CAAAewgFu0HU+AAEAAElEQVR4nOz9V4wlWZrnif2O2dVaC9faQ0dkpKrMktlV1V09NT3TMz2ziuAQxHCJfSBAg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qseB2ubBarbQ7HdY2N7n0iz9n++bn1LJ7+Lwe3rhwHr/Xi91qg14HPbuGtvIJenrF2InLCGaFEEaWW1ERjscRfnsIqgURm0I2y4jQMLKeZ/jM25ycvtN/JCJjdELjtDJb4AygDpyCVsX4ndOH8IQRngh0n07vixl4Pz5/cdfP//PjNhBCKMC/OHhYAn79dIdk8k1ASole3DuytHkboSiEwjG2Fq6hF3aQUuKMjWK12cktfI7wxYiPTtHr9Zi78hmFnRXisSj7i1eQWhdHdIRGo05te5FoKIhNAUunTrfbQc9v4YyPky+W8A1N02g1GRkcZHV1hf1L/x7ajf4YX2REIEm3p6EdLJe+rEgpkbqGtr/I3tXfsPTzf82NT39NrVxE14//H7hdLqbGx5idnCDgN5uyTUwehKIojA0f1jqwWq2odhcAjbXLZDNpRoaG8LgP1QITDPjJ5PLPbKzPing0ypsXznPmxCxWi1Ew0Wg2WV66xaVLn3L52nXqjQYOh4ORmTNgdSDCoyiRMfRKGm31U2hWEIFkf59CKP2ynSeBEAqKP4ESHASLDXQNm9ND0O/D5zUUoWVhm3AkdrA6IcF
"text/plain": [
"<Figure size 1200x1200 with 1 Axes>"
]
},
"metadata": {
"needs_background": "light"
},
"output_type": "display_data"
}
],
"source": [
"plt.figure(figsize=(6,6),dpi=200)\n",
"plt.imshow(quantized_image)"
]
},
{
"cell_type": "code",
"execution_count": null,
"metadata": {},
"outputs": [],
"source": []
}
],
"metadata": {
"anaconda-cloud": {},
"kernelspec": {
"display_name": "Python 3",
"language": "python",
"name": "python3"
},
"language_info": {
"codemirror_mode": {
"name": "ipython",
"version": 3
},
"file_extension": ".py",
"mimetype": "text/x-python",
"name": "python",
"nbconvert_exporter": "python",
"pygments_lexer": "ipython3",
"version": "3.8.5"
}
},
"nbformat": 4,
"nbformat_minor": 1
}