Processing#

Generate image processing kernels

kerpy.processing.gaussian(size=(3, 3), std=(1, 1), normalize=True) Kernel#

Returns a real kernel that corresponds to the gaussian kernel.

Example :
\[\begin{split}\left( \begin{array}{ c, c, c} 0.08 & 0.12 & 0.08\\ 0.12 & 0.20 & 0.12\\ 0.08 & 0.12 & 0.08 \end{array} \right)\end{split}\]
Parameters:
  • size ((int, int)) – Tuple defining the size of the kernel respectively in the x and y direction, defaults to (3,3)

  • std ((int, int)) – Tuple defining the standard deviation of the kernel respectively in the x and y direction, defaults to (1,1)

  • normalize (bool) – Set the sum of all coefficients equal to one to conserve to global mass.

Returns:

a Kernel object

Return type:

Kernel

kerpy.processing.mean(size=(3, 3)) Kernel#

Returns a real kernel that corresponds to the ones matrix divided the number of element.

Example :
\[\begin{split}\left( \begin{array}{ c, c, c} 0.11 & 0.11 & 0.11\\ 0.11 & 0.11 & 0.11\\ 0.11 & 0.11 & 0.11 \end{array} \right)\end{split}\]
Parameters:

size ((int, int)) – Tuple defining the size of the kernel respectively in the x and y direction, defaults to (3,3)

Returns:

a Kernel object

Return type:

Kernel

kerpy.processing.sharpen(size: tuple[int, int] = (3, 3)) Kernel#

Returns the identitical kernel plus the laplacian in order to sharpen an image.

Example :
\[\begin{split}\left( \begin{array}{ c, c, c} 0.00 & -1.00 & 0.00\\ -1.00 & 5.00 & -1.00\\ 0.00 & -1.00 & 0.00 \end{array} \right)\end{split}\]
Parameters:

size ((int, int)) – Tuple defining the size of the kernel respectively in the x and y direction, defaults to (3,3)

Returns:

a Kernel object

Return type:

Kernel

kerpy.processing.unsharp(size=(3, 3), std=(1, 1)) Kernel#

Returns a real kernel that corresponds to the gaussian kernel minus two times the identity kernel.

Example :
\[\begin{split}\left( \begin{array}{ c, c, c} -0.08 & -0.12 & -0.08\\ -0.12 & 1.80 & -0.12\\ -0.08 & -0.12 & -0.08 \end{array} \right)\end{split}\]
Parameters:
  • size ((int, int)) – Tuple defining the size of the kernel respectively in the x and y direction, defaults to (3,3)

  • std ((int, int)) – Tuple defining the standard deviation of the kernel respectively in the x and y direction, defaults to (1,1)

Returns:

a Kernel object

Return type:

Kernel