preprocessing-an-image
preprocessing-an-image
[29]: # getting an image using the web get , we can use to get any immage by the link
!wget 'https://encrypted-tbn0.gstatic.com/images?q=tbn:
↪ANd9GcQwCYdvAtKsDTRLlMg9k-x97nZUpuDSHU_3Ng&s'
img = mpimg.imread('/content/space')
1
type(img)
[30]: numpy.ndarray
[45]: print(img.shape)
# first and second values gives us the dimesion of the image and them third␣
↪value gives us the info about the color channel
(168, 300, 3)
[32]: # convert the numpy array to an image or display the image from the numpy array
img_plot = plt.imshow(img)
plt.show()
img.shape
2
img1
[34]:
3
[36]: # to save the resized file
img1_resize.save('space_image_resized.jpg')
[38]: print(img_resz.shape)
(300, 300, 3)
print(img2.shape)
4
(168, 300, 3)
(168, 300)
[43]: cv2_imshow(gray_scale_img)
[44]: True
[ ]:
[ ]:
[ ]:
[ ]:
5
[ ]:
[ ]:
[ ]: