imgcv.filters.utils

Functions

pad_image(img, filter_size)

Pad the image with zeros.

apply_convolution(img, kernels, seperate[, take_mean])

Apply convolution operation to the image.

Module Contents

imgcv.filters.utils.pad_image(img, filter_size)

Pad the image with zeros.

Parameters:
  • img (np.ndarray) – Input Image array

  • filter_size (Tuple[int, int]) – Size of the filter.

Returns:

Padded image array.

Return type:

np.ndarray

imgcv.filters.utils.apply_convolution(img, kernels, seperate, take_mean=False)

Apply convolution operation to the image.

Parameters:
  • img (np.ndarray) – Input Image array

  • kernels (List[np.ndarray, np.ndarray]) – List of kernels to apply.

  • seperate (bool) – If True, apply the kernels seperately in x and y direction respectively.

Raises:
  • ValueError – If kernels is not a list of length 1 or 2.

  • ValueError – If seperate is not a boolean value.

  • ValueError – If both kernels are not of same shape.

Returns:

Image array after applying convolution.

Return type:

np.ndarray