So far we have seen filters that are used commonly in image processing and are widely accepted by researchers and developers. But there are times when you want to design your own filter. The good news is you do not have to write the entire convolution process again from scratch. Skimage and pillow both provide the option of applying custom filters on images.
The following function can be used to create a kernel for a filter in pillow:
>>> from PIL import ImageFilter>>> kernel = ImageFilter.Kernel((3,3), [1,2,3,4,5,6,7,8,9])
The kernel function takes the size, the sequence of kernel weights, the scale, and the offset as parameters, where size is the size of the matrix, scale is the value by which the result of the pixel is divided, ...