November 2018
Intermediate to advanced
492 pages
12h 19m
English
With scipy.ndimage.convolve(), we can sharpen an RGB image directly (we do not have to apply the convolution separately for each image channel).
Use the victoria_memorial.png image with the sharpen kernel and the emboss kernel:
im = misc.imread('../images/victoria_memorial.png').astype(np.float) # read as floatprint(np.max(im))sharpen_kernel = np.array([0, -1, 0, -1, 5, -1, 0, -1, 0]).reshape((3, 3, 1))emboss_kernel = np.array(np.array([[-2,-1,0],[-1,1,1],[0,1,2]])).reshape((3, 3, 1))im_sharp = ndimage.convolve(im, sharpen_kernel, mode='nearest')im_sharp = np.clip(im_sharp, 0, 255).astype(np.uint8) # clip (0 to 255) and convert to unsigned intim_emboss = ndimage.convolve(im, emboss_kernel, mode='nearest') ...Read now
Unlock full access