Skip to content

Commit

Permalink
Typo on last example, RGB intensity (0, 59, 120) was (0.0, 0.0, 1.0)
Browse files Browse the repository at this point in the history
  • Loading branch information
Naereen authored Jun 7, 2017
1 parent acf227e commit 2eb310c
Showing 1 changed file with 20 additions and 20 deletions.
40 changes: 20 additions & 20 deletions image_as_3d_array.ipynb
Original file line number Diff line number Diff line change
Expand Up @@ -49,13 +49,13 @@
"# loading image\n",
"img = mpimg.imread('i/super_mario_head.png')\n",
"# creates sub plots of 15x15\n",
"f, (plt1, plt2, plt3, plt4) = plt.subplots(1, 4,figsize=(15,15))\n",
"f, (plt1, plt2, plt3, plt4) = plt.subplots(1, 4, figsize=(15, 15))\n",
"\n",
"plt1.set_title('Original');plt1.imshow(img);\n",
"plt1.set_title('Original'); plt1.imshow(img);\n",
"# showing each channel img[x,y,color_plane] \n",
"plt2.axis('off');plt2.set_title('Red');plt2.imshow(img[:,:,0],cmap='gray');\n",
"plt3.axis('off');plt3.set_title('Luigi');plt3.imshow(img[:,:,1],cmap='gray');\n",
"plt4.axis('off');plt4.set_title('Blue');plt4.imshow(img[:,:,2],cmap='gray');"
"plt2.axis('off'); plt2.set_title('Red'); plt2.imshow(img[:,:,0], cmap='gray');\n",
"plt3.axis('off'); plt3.set_title('Luigi'); plt3.imshow(img[:,:,1], cmap='gray');\n",
"plt4.axis('off'); plt4.set_title('Blue'); plt4.imshow(img[:,:,2], cmap='gray');"
]
},
{
Expand All @@ -78,17 +78,17 @@
],
"source": [
"# creates sub plots of 15x15\n",
"f, (plt1, plt2, plt3, plt4) = plt.subplots(1, 4,figsize=(15,15))\n",
"f, (plt1, plt2, plt3, plt4) = plt.subplots(1, 4, figsize=(15, 15))\n",
"\n",
"# cutting the image\n",
"eye_brow = img[100:150,150:200,]\n",
"eye_split = eye_brow[40:50,20:30]\n",
"zoomed_eye_split = eye_split[4:8,0:4]\n",
"eye_brow = img[100:150, 150:200,]\n",
"eye_split = eye_brow[40:50, 20:30]\n",
"zoomed_eye_split = eye_split[4:8, 0:4]\n",
"\n",
"plt1.axis('off');plt1.imshow(img,interpolation='nearest');\n",
"plt2.axis('off');plt2.imshow(eye_brow,interpolation='nearest');\n",
"plt3.axis('off');plt3.imshow(eye_split,interpolation='nearest');\n",
"plt4.axis('off');plt4.imshow(zoomed_eye_split,interpolation='nearest');"
"plt1.axis('off'); plt1.imshow(img, interpolation='nearest');\n",
"plt2.axis('off'); plt2.imshow(eye_brow, interpolation='nearest');\n",
"plt3.axis('off'); plt3.imshow(eye_split, interpolation='nearest');\n",
"plt4.axis('off'); plt4.imshow(zoomed_eye_split, interpolation='nearest');"
]
},
{
Expand All @@ -109,17 +109,17 @@
"name": "stdout",
"output_type": "stream",
"text": [
"R intensity at x=3, y=3 is 0.0\n",
"G intensity at x=3, y=3 is 0.0\n",
"B intensity at x=3, y=3 is 1.0\n"
"R intensity at x=3, y=3 is 0\n",
"G intensity at x=3, y=3 is 59\n",
"B intensity at x=3, y=3 is 120\n"
]
}
],
"source": [
"latest_pixel = zoomed_eye_split[3,3]\n",
"print(\"R intensity at x=3, y=3 is\",round(latest_pixel[0]))\n",
"print(\"G intensity at x=3, y=3 is\",round(latest_pixel[1]))\n",
"print(\"B intensity at x=3, y=3 is\",round(latest_pixel[2]))"
"latest_pixel = zoomed_eye_split[3, 3]\n",
"print(\"R intensity at x=3, y=3 is\",round(256 * latest_pixel[0]))\n",
"print(\"G intensity at x=3, y=3 is\",round(256 * latest_pixel[1]))\n",
"print(\"B intensity at x=3, y=3 is\",round(256 * latest_pixel[2]))"
]
}
],
Expand Down

0 comments on commit 2eb310c

Please sign in to comment.