November 2018
Intermediate to advanced
492 pages
12h 19m
English
You can use seam carving to remove objects or artifacts from images too. This requires weighting the object region with low values, since the lower weights are preferentially removed in seam carving. The following code block uses a mask image of the same shape as the original input photo that masks the region of the photo containing the dog with a low weight, indicating that it should be removed:
image = imread('man.jpg')mask_img = rgb2gray(imread('man_mask.jpg'))print(image.shape)pylab.figure(figsize=(15,10))pylab.subplot(121), pylab.imshow(image), pylab.title('Original Image')pylab.subplot(122), pylab.imshow(mask_img), pylab.title('Mask for the object to be removed (the dog)') pylab.show()
The following ...
Read now
Unlock full access