# importing requires modules
import mahotas
import numpy as np
from pylab import imread, gray, show, imshow
# loading image
photo = mahotas.imread('HarryPotter.jpg')
# showing the original image
print("Before Thresholding : ")
imshow(photo)
show()
t = np.uint8(200)
# setting filter to the image
img = photo[:, :, 0]
img = mahotas.thresholding.soft_threshold(img, t)
# showing image after thresholding
print("After Thresholding : ")
imshow(img)
show()
Comments