April 2020
Intermediate to advanced
438 pages
12h 2m
English
You need to perform the following steps to be able to apply some of the morphological operators to a binary image using the functions from the scipy.ndimage.morphology module:
im = rgb2gray(imread('images/giraffe.jpg'))thres = threshold_otsu(im)im = (im > thres).astype(np.uint8)
eroded = binary_erosion(im, structure=np.ones((2,2)), iterations=20)[20:,20:]eroded = 1 - eroded
Read now
Unlock full access