To know how to do image processing with scipy.ndimage in python.
Face Image of panda.
Import necessary library.
Load image from misc.face() package.
Convert gray scale image using arguments.
Rotate the image using scipy.ndimage().
Plot the final images.
from scipy import misc,ndimage
from matplotlib import pyplot as plt
import numpy as np
#get face image of panda from misc package
image = misc.face()
#plot or show image of face
print(“Original image”)
plt.imshow(image)
plt.show()
#gray scale image
print(“Gray scale image”)
image1 = misc.face(gray = True)
#plot or show image of face
plt.imshow(image1)
plt.show()
#rotating image
print(“Rotated image”)
image_rotate = ndimage.rotate(image, 35)
plt.imshow(image_rotate)
plt.show()