PIL is the Python Imaging Library which provides the python interpreter with image editing capabilities. The ImageFilter module contains definitions for a pre-defined set of filters, which can be used with the
PIL.ImageFilter.Kernel() Create a convolution kernel. The current version only supports 3×3 and 5×5 integer and floating point kernels.
Syntax: PIL.ImageFilter.Kernel(size, kernel, scale=None, offset=0)
size – Kernel size, given as (width, height). In the current version, this must be (3, 3) or (5, 5).
kernel – A sequence containing kernel weights.
scale – Scale factor. If given, the result for each pixel is divided by this value. the default is the sum of the kernel weights.
offset – Offset. If given, this value is added to the result, after it has been divided by the scale factor.
Returns type: An image.
Another example: Here change kernel value to obtain output, we can change other parameters as well.
- Creating linear kernel SVM in Python
- Difference between Method Overloading and Method Overriding in Python
- class method vs static method in Python
- Python | next() method
- Python | set() method
- Python | os.dup() method
- Python | os.getppid() method
- Python | Decimal exp() method
- Python | os.ctermid() method
- Python | os.getenv() method
- Python | os.getlogin() method
- Python | sympy.S() method
- Python | cmath.log() method
- Python | Decimal ln() method
- Python | sympy.det() method