SMIL 1.1.2
Loading...
Searching...
No Matches
Convolution

2D and 3D Convolution with linear kernels More...

Detailed Description

2D and 3D Convolution with linear kernels

+ Collaboration diagram for Convolution:

Functions

template<class T >
RES_T gaussianFilter (Image< T > &imIn, int radius, Image< T > &imOut)
 gaussianFilter() - 3D Gaussian filter
 
template<class T >
RES_T horizConvolve (const Image< T > &imIn, const vector< double > &kernel, Image< T > &imOut)
 horizConvolve() - 2D Horizontal convolution
 
template<class T >
RES_T vertConvolve (const Image< T > &imIn, const vector< double > &kernel, Image< T > &imOut)
 vertConvolve() - 2D Vertical convolution
 
template<class T >
RES_T convolve (const Image< T > &imIn, const vector< double > &kernel, Image< T > &imOut)
 convolve() - 2D Convolution
 

Function Documentation

◆ gaussianFilter()

template<class T >
RES_T gaussianFilter ( Image< T > &  imIn,
int  radius,
Image< T > &  imOut 
)

gaussianFilter() - 3D Gaussian filter

Gaussian Filter : convolution de l'input image against a Gaussian Kernel of size 2 * radius + 1

The kernel is defined, in each direction, by :

\[
 kernel[i] = exp(- \frac{i^2}{2 . \sigma^2}),
 \; i \in [-radius, +radius],
 \;\sigma = radius / 2
\]

Parameters
[in]imIn: input image
[in]radius: radius of the gaussian kernel
[out]imOut: output image

Example

import smilPython as sp
imIn = sp.Image("https://smil.cmm.minesparis.psl.eu/images/lena.png")
imOut = sp.Image(imIn)
imIn.show()
imOut.show()
sp.gaussianFilter(imIn, 3, imOut)

◆ horizConvolve()

template<class T >
RES_T horizConvolve ( const Image< T > &  imIn,
const vector< double > &  kernel,
Image< T > &  imOut 
)

horizConvolve() - 2D Horizontal convolution

2D horizontal convolution using a 1D kernel

Parameters
[in]imIn: input image
[in]kernel: an 1D kernel (as a vector)
[out]imOut: output image

Example:

import smilPython as sp
im1 = sp.Image("https://smil.cmm.minesparis.psl.eu/images/lena.png")
im2 = sp.Image(im1)
kern = [ 0.0545, 0.2442, 0.4026, 0.2442, 0.0545 ]
sp.horizConvolve(im1, kern, im2)
im1.show()
im2.show()

◆ vertConvolve()

template<class T >
RES_T vertConvolve ( const Image< T > &  imIn,
const vector< double > &  kernel,
Image< T > &  imOut 
)

vertConvolve() - 2D Vertical convolution

2D vertical convolution using a 1D kernel

Parameters
[in]imIn: input image
[in]kernel: an 1D kernel (vector)
[out]imOut: output image
See also
horizConvolve()

◆ convolve()

template<class T >
RES_T convolve ( const Image< T > &  imIn,
const vector< double > &  kernel,
Image< T > &  imOut 
)

convolve() - 2D Convolution

2D convolution by & 1D kernel. Vertical convolution followed by an horizontal convolution using the same 1D kernel.

Parameters
[in]imIn: input image
[in]kernel: the 1D kernel (vector)
[out]imOut: output image
See also
horizConvolve()