Skip to content

Commit

Permalink
fixed small error
Browse files Browse the repository at this point in the history
  • Loading branch information
NadiaBlostein committed May 5, 2023
1 parent b4cf4ab commit c64f00a
Showing 1 changed file with 34 additions and 28 deletions.
62 changes: 34 additions & 28 deletions PNG_preparation.ipynb
Original file line number Diff line number Diff line change
Expand Up @@ -203,10 +203,16 @@
"images_adjusted = []\n",
"for i in range(20):\n",
" img = images[i]\n",
" if len(img.shape) != 2:\n",
" grayscale=rgb2gray(img)\n",
" images_adjusted.append(grayscale)\n",
"\n",
" if len(img.shape) != 2: grayscale=rgb2gray(img)\n",
" images_adjusted.append(grayscale)"
]
},
{
"cell_type": "code",
"execution_count": null,
"metadata": {},
"outputs": [],
"source": [
"fig = plt.figure(figsize=(20, 15))\n",
"rows = 5\n",
"columns = 4\n",
Expand Down Expand Up @@ -326,14 +332,14 @@
"metadata": {},
"outputs": [],
"source": [
"# height=[]\n",
"# width=[]\n",
"# for i in range(20):\n",
"# img=images_adjusted[i]\n",
"# height.append(img.shape[0])\n",
"# width.append(img.shape[1])\n",
"# print(f'Smallest image height: {min(height)}')\n",
"# print(f'Smallest image width: {min(width)}')"
"height=[]\n",
"width=[]\n",
"for i in range(20):\n",
" img=images_adjusted[i]\n",
" height.append(img.shape[0])\n",
" width.append(img.shape[1])\n",
"print(f'Smallest image height: {min(height)}')\n",
"print(f'Smallest image width: {min(width)}')"
]
},
{
Expand All @@ -342,13 +348,13 @@
"metadata": {},
"outputs": [],
"source": [
"# trimmed_images=[]\n",
"# for i in range(20):\n",
"# img=images_adjusted[i]\n",
"# img_trim=img[0:min(height),0:min(width)]\n",
"# trimmed_images.append(img_trim)\n",
"# trimmed_images_array = np.array(trimmed_images)\n",
"# trimmed_images_array.shape"
"trimmed_images=[]\n",
"for i in range(20):\n",
" img=images_adjusted[i]\n",
" img_trim=img[0:min(height),0:min(width)]\n",
" trimmed_images.append(img_trim)\n",
"trimmed_images_array = np.array(trimmed_images)\n",
"trimmed_images_array.shape"
]
},
{
Expand All @@ -357,15 +363,15 @@
"metadata": {},
"outputs": [],
"source": [
"# fig = plt.figure(figsize=(20, 15))\n",
"# rows = 5\n",
"# columns = 4\n",
"# for i in range(20):\n",
"# fig.add_subplot(rows, columns, i+1)\n",
"# img=trimmed_images_array[i]\n",
"# plt.imshow(img)\n",
"# plt.axis('off')\n",
"# plt.title(img.shape)"
"fig = plt.figure(figsize=(20, 15))\n",
"rows = 5\n",
"columns = 4\n",
"for i in range(20):\n",
" fig.add_subplot(rows, columns, i+1)\n",
" img=trimmed_images_array[i]\n",
" plt.imshow(img)\n",
" plt.axis('off')\n",
" plt.title(img.shape)"
]
},
{
Expand Down

0 comments on commit c64f00a

Please sign in to comment.