SLIP  1.4
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Groups Pages
Namespaces
convolution.hpp File Reference

Provides some convolution algorithms. More...

#include <algorithm>
#include <numeric>
#include <cassert>
#include <iterator>
#include <vector>
#include "arithmetic_op.hpp"
#include "border_treatment.hpp"
#include "Array.hpp"
#include "Array3d.hpp"
#include "Box2d.hpp"
#include "Vector.hpp"
#include "FFT.hpp"
#include "apply.hpp"
Include dependency graph for convolution.hpp:
This graph shows which files directly or indirectly include this file:

Go to the source code of this file.

Namespaces

 slip
 This namespace corresponds to the kernel of the Simple Library on Image Processing (SLIP). That is to say that it contains the data structures and the algorithms needed by these data strucutres.
 

Functions

1d convolutions
template<typename SrcIter , typename KernelIter , typename ResIter >
void slip::valid_convolution (SrcIter first, SrcIter last, KernelIter kernel_first, KernelIter kernel_last, std::size_t ksize_left, std::size_t ksize_right, ResIter result)
 Computes the valid convolution of signal by a 1d-kernel. More...
 
template<typename SrcIter , typename KernelIter , typename ResIter >
void slip::full_convolution (SrcIter first, SrcIter last, KernelIter kernel_first, KernelIter kernel_last, ResIter result)
 Computes the full convolution of signal by a 1d-kernel. More...
 
template<typename SrcIter , typename KernelIter , typename ResIter >
void slip::same_convolution (SrcIter first, SrcIter last, KernelIter kernel_first, KernelIter kernel_last, std::size_t ksize_left, std::size_t ksize_right, ResIter result, slip::BORDER_TREATMENT bt=slip::BORDER_TREATMENT_ZERO_PADDED)
 Computes the same convolution of signal by a 1d-kernel. More...
 
template<typename SrcIter , typename KernelIter , typename ResIter >
void slip::same_convolution (SrcIter first, SrcIter last, KernelIter kernel_first, KernelIter kernel_last, ResIter result, slip::BORDER_TREATMENT bt=slip::BORDER_TREATMENT_ZERO_PADDED)
 Computes the same convolution of signal by a symmetric 1d-kernel support. More...
 
template<typename Vector1 , typename Vector2 , typename Vector3 >
void slip::same_convolution (const Vector1 &Signal, const Vector2 &Kernel, Vector3 &Result, slip::BORDER_TREATMENT bt=slip::BORDER_TREATMENT_ZERO_PADDED)
 Computes the same convolution of signal by a symmetric 1d-kernel. More...
 
template<typename RandomAccessIterator1 , typename RandomAccessIterator2 , typename RandomAccessIterator3 >
void slip::fft_circular_convolution (RandomAccessIterator1 first, RandomAccessIterator1 last, RandomAccessIterator2 first2, RandomAccessIterator2 last2, RandomAccessIterator3 conv_first, RandomAccessIterator3 conv_last)
 Computes the FFT circular convolution. More...
 
template<typename RandomAccessIterator1 , typename RandomAccessIterator2 , typename RandomAccessIterator3 >
void slip::fft_convolution (RandomAccessIterator1 first, RandomAccessIterator1 last, RandomAccessIterator2 first2, RandomAccessIterator2 last2, RandomAccessIterator3 conv_first, RandomAccessIterator3 conv_last)
 Computes the FFT convolution. More...
 
template<typename Vector1 , typename Vector2 , typename Vector3 >
void slip::fft_convolution (const Vector1 &Signal, const Vector2 &Kernel, Vector3 &Result)
 Computes the fft convolution of signal by a symmetric 1d-kernel. More...
 
2d convolutions
template<typename RandomAccessIterator2d1 , typename KernelIter1 , typename KernelIter2 , typename RandomAccessIterator2d2 >
void slip::separable_convolution2d (RandomAccessIterator2d1 I_up, RandomAccessIterator2d1 I_bot, KernelIter1 k1_first, KernelIter1 k1_last, std::size_t ksize_left1, std::size_t ksize_right1, slip::BORDER_TREATMENT bt1, KernelIter2 k2_first, KernelIter2 k2_last, std::size_t ksize_left2, std::size_t ksize_right2, slip::BORDER_TREATMENT bt2, RandomAccessIterator2d2 R_up)
 Computes the separable convolution of a 2d signal by two asymmetric 1d-kernels support. More...
 
template<typename RandomAccessIterator2d1 , typename KernelIter1 , typename KernelIter2 , typename RandomAccessIterator2d2 >
void slip::separable_convolution2d (RandomAccessIterator2d1 I_up, RandomAccessIterator2d1 I_bot, KernelIter1 k1_first, KernelIter1 k1_last, KernelIter2 k2_first, KernelIter2 k2_last, RandomAccessIterator2d2 R_up, slip::BORDER_TREATMENT bt=slip::BORDER_TREATMENT_ZERO_PADDED)
 Computes the separable convolution of a 2d signal by two symmetric 1d-kernels support. More...
 
template<typename Container1 , typename Kernel1 , typename Kernel2 , typename Container2 >
void slip::separable_convolution2d (const Container1 &Signal, const Kernel1 &kernel1, const Kernel2 &kernel2, Container2 &Result, slip::BORDER_TREATMENT bt=slip::BORDER_TREATMENT_ZERO_PADDED)
 Computes the separable convolution of 2d signal by 2 symmetric 1d-kernel support. More...
 
template<typename RandomAccessIterator2d1 , typename KernelIter1 , typename KernelIter2 >
void slip::separable_convolution2d (RandomAccessIterator2d1 I_up, RandomAccessIterator2d1 I_bot, KernelIter1 k1_first, KernelIter1 k1_last, std::size_t ksize_left1, std::size_t ksize_right1, slip::BORDER_TREATMENT bt1, KernelIter2 k2_first, KernelIter2 k2_last, std::size_t ksize_left2, std::size_t ksize_right2, slip::BORDER_TREATMENT bt2)
 Computes the in-place separable convolution of a 2d signal by two asymmetric 1d-kernels support. More...
 
template<typename RandomAccessIterator2d1 , typename KernelIter1 , typename KernelIter2 , typename RandomAccessIterator2d2 >
void slip::separable_fft_convolution2d (RandomAccessIterator2d1 I_up, RandomAccessIterator2d1 I_bot, KernelIter1 k1_first, KernelIter1 k1_last, KernelIter2 k2_first, KernelIter2 k2_last, RandomAccessIterator2d2 R_up)
 Computes the separable 2d convolution of signal using the fft algorithm. More...
 
template<typename Container1 , typename Kernel1 , typename Kernel2 , typename Container2 >
void slip::separable_fft_convolution2d (const Container1 &Signal, const Kernel1 &kernel1, const Kernel2 &kernel2, Container2 &Result)
 Computes the fft convolution of a 2d signal. More...
 
template<typename SrcIter2d , typename KernelIter2d , typename ResIter2d >
void slip::valid_convolution2d (SrcIter2d S_up, SrcIter2d S_bot, KernelIter2d kernel_up, KernelIter2d kernel_bot, std::size_t ksize_left, std::size_t ksize_right, std::size_t ksize_up, std::size_t ksize_bot, ResIter2d R_up, ResIter2d R_bot)
 Computes the valid convolution of 2d signal by a 2d-kernel. More...
 
template<typename SrcIter2d , typename KernelIter2d , typename ResIter2d >
void slip::same_convolution2d (SrcIter2d S_up, SrcIter2d S_bot, KernelIter2d kernel_up, KernelIter2d kernel_bot, int ksize_left, int ksize_right, int ksize_up, int ksize_bot, ResIter2d R_up, ResIter2d R_bot, slip::BORDER_TREATMENT bt=slip::BORDER_TREATMENT_ZERO_PADDED)
 Computes the same convolution of 2d signal by a 2d-kernel. More...
 
template<typename SrcIter2d , typename KernelIter2d , typename ResIter2d >
void slip::same_convolution2d (SrcIter2d S_up, SrcIter2d S_bot, KernelIter2d kernel_up, KernelIter2d kernel_bot, ResIter2d R_up, ResIter2d R_bot, slip::BORDER_TREATMENT bt=slip::BORDER_TREATMENT_ZERO_PADDED)
 Computes the same convolution of 2d signal by a symmetric 2d-kernel support. More...
 
template<typename Container2d1 , typename Kernel2d , typename Container2d2 >
void slip::same_convolution2d (const Container2d1 &Signal, const Kernel2d &Kernel, Container2d2 &Result, slip::BORDER_TREATMENT bt)
 Computes the same convolution of 2d signal by a symmetric 2d-kernel. More...
 
template<typename SrcIter2d , typename KernelIter2d , typename ResIter2d >
void slip::full_convolution2d (SrcIter2d S_up, SrcIter2d S_bot, KernelIter2d kernel_up, KernelIter2d kernel_bot, ResIter2d R_up, ResIter2d R_bot)
 Computes the full convolution of 2d signal by a 2d-kernel. More...
 
template<typename InputIterator2d1 , typename InputIterator2d2 , typename OutputIterator2d >
void slip::fft_convolution2d (InputIterator2d1 in1_upper_left, InputIterator2d1 in1_bottom_right, InputIterator2d2 in2_upper_left, InputIterator2d2 in2_bottom_right, OutputIterator2d out_upper_left, OutputIterator2d out_bottom_right)
 Computes the standard crosscorrelation between two 2D sequences using fft2d. More...
 
template<typename Container2d1 , typename Kernel2d , typename Container2d2 >
void slip::fft_convolution2d (const Container2d1 &Signal, const Kernel2d &Kernel, Container2d2 &Result)
 Computes the convolution of a 2d signal using the fft2d. More...
 
3d convolutions
template<typename RandomAccessIterator3d1 , typename KernelIter1 , typename KernelIter2 , typename KernelIter3 , typename RandomAccessIterator3d2 >
void slip::separable_convolution3d (RandomAccessIterator3d1 I_up, RandomAccessIterator3d1 I_bot, KernelIter1 k1_first, KernelIter1 k1_last, std::size_t ksize_left1, std::size_t ksize_right1, slip::BORDER_TREATMENT bt1, KernelIter2 k2_first, KernelIter2 k2_last, std::size_t ksize_left2, std::size_t ksize_right2, slip::BORDER_TREATMENT bt2, KernelIter3 k3_first, KernelIter3 k3_last, std::size_t ksize_left3, std::size_t ksize_right3, slip::BORDER_TREATMENT bt3, RandomAccessIterator3d2 R_up)
 Computes the separable convolution of a 3d signal by 3 asymmetric 1d-kernels. More...
 
template<typename RandomAccessIterator3d1 , typename KernelIter1 , typename KernelIter2 , typename KernelIter3 , typename RandomAccessIterator3d2 >
void slip::separable_convolution3d (RandomAccessIterator3d1 I_up, RandomAccessIterator3d1 I_bot, KernelIter1 k1_first, KernelIter1 k1_last, KernelIter2 k2_first, KernelIter2 k2_last, KernelIter3 k3_first, KernelIter3 k3_last, RandomAccessIterator3d2 R_up, slip::BORDER_TREATMENT bt=slip::BORDER_TREATMENT_ZERO_PADDED)
 Computes the separable convolution of a 3d signal by 3 symmetric 1d-kernels. More...
 
template<typename Container1 , typename Kernel1 , typename Kernel2 , typename Kernel3 , typename Container2 >
void slip::separable_convolution3d (const Container1 &Signal, const Kernel1 &kernel1, const Kernel2 &kernel2, const Kernel3 &kernel3, Container2 &Result, slip::BORDER_TREATMENT bt=slip::BORDER_TREATMENT_ZERO_PADDED)
 Computes the separable convolution of 3d signal by a 3 1d-kernel. More...
 
template<typename RandomAccessIterator3d1 , typename KernelIter1 , typename KernelIter2 , typename KernelIter3 >
void slip::separable_convolution3d (RandomAccessIterator3d1 I_up, RandomAccessIterator3d1 I_bot, KernelIter1 k1_first, KernelIter1 k1_last, std::size_t ksize_left1, std::size_t ksize_right1, slip::BORDER_TREATMENT bt1, KernelIter2 k2_first, KernelIter2 k2_last, std::size_t ksize_left2, std::size_t ksize_right2, slip::BORDER_TREATMENT bt2, KernelIter3 k3_first, KernelIter3 k3_last, std::size_t ksize_left3, std::size_t ksize_right3, slip::BORDER_TREATMENT bt3)
 Computes the in-place separable convolution of a 3d signal by 3 asymmetric 1d-kernels. More...
 
template<typename RandomAccessIterator3d1 , typename KernelIter1 , typename KernelIter2 , typename KernelIter3 , typename RandomAccessIterator3d2 >
void slip::separable_fft_convolution3d (RandomAccessIterator3d1 I_up, RandomAccessIterator3d1 I_bot, KernelIter1 k1_first, KernelIter1 k1_last, KernelIter2 k2_first, KernelIter2 k2_last, KernelIter3 k3_first, KernelIter3 k3_last, RandomAccessIterator3d2 R_up)
 Computes the separable 3d convolution of signal using the fft algorithm. More...
 
template<typename Container1 , typename Kernel1 , typename Kernel2 , typename Kernel3 , typename Container2 >
void slip::separable_fft_convolution3d (const Container1 &Signal, const Kernel1 &kernel1, const Kernel2 &kernel2, const Kernel3 &kernel3, Container2 &Result)
 Computes the separable fft convolution of 3d signal by 3 1d-kernel. More...
 
template<typename InputIterator3d1 , typename InputIterator3d2 , typename OutputIterator3d >
void slip::fft_convolution3d (InputIterator3d1 in1_front_upper_left, InputIterator3d1 in1_back_bottom_right, InputIterator3d2 in2_front_upper_left, InputIterator3d2 in2_back_bottom_right, OutputIterator3d out_front_upper_left, OutputIterator3d out_back_bottom_right)
 Computes the convolution of two 3D sequences using fft3d. More...
 
template<typename Container3d1 , typename Kernel3d , typename Container3d2 >
void slip::fft_convolution3d (const Container3d1 &Signal, const Kernel3d &Kernel, Container3d2 &Result)
 Computes the convolution of a 3d signal using the fft3d. More...
 
template<typename InputIterator3d1 , typename InputIterator3d2 , typename OutputIterator3d >
void slip::fft_convolution3d_same (InputIterator3d1 in1_front_upper_left, InputIterator3d1 in1_back_bottom_right, InputIterator3d2 in2_front_upper_left, InputIterator3d2 in2_back_bottom_right, OutputIterator3d out_front_upper_left, OutputIterator3d out_back_bottom_right)
 Computes the convolution between two 3D sequences using fft3d. More...
 
template<typename SrcIter3d , typename KernelIter3d , typename ResIter3d >
void slip::valid_convolution3d (SrcIter3d S_up, SrcIter3d S_bot, KernelIter3d kernel_up, KernelIter3d kernel_bot, std::size_t ksize_front, std::size_t ksize_back, std::size_t ksize_left, std::size_t ksize_right, std::size_t ksize_up, std::size_t ksize_bot, ResIter3d R_up, ResIter3d R_bot)
 Computes the valid convolution of 3d signal by a 3d-kernel. More...
 

Detailed Description

Provides some convolution algorithms.

Since
1.0.0

Definition in file convolution.hpp.