ipfml.filters.convolution

Convolution functions to apply on images

Functions

convolution2D(image, kernel[, kernel_size]) Apply 2D convolution on image using specific kernel from ipfml.filters.kernels
ipfml.filters.convolution.convolution2D(image, kernel, kernel_size=(5, 5))[source]

Apply 2D convolution on image using specific kernel from ipfml.filters.kernels

Parameters:
  • image – 2D image to apply convolution on
  • kernel – specific kernel from ipfml.filters.kernels to use
  • kernel_size – window size to use (default (5, 5))
Returns:

2D numpy array obtained from image using kernel

Example:

>>> from ipfml.filters.convolution import convolution2D
>>> from ipfml.filters.kernels import plane_mean
>>> import numpy as np
>>> image = np.arange(81).reshape([9, 9])
>>> convolved_image = convolution2D(image, plane_mean, (3, 3))
>>> convolved_image.shape
(7, 7)