Multidimensional discrete convolution

From HandWiki

In signal processing, multidimensional discrete convolution refers to the mathematical operation between two functions f and g on an n-dimensional lattice that produces a third function, also of n-dimensions. Multidimensional discrete convolution is the discrete analog of the multidimensional convolution of functions on Euclidean space. It is also a special case of convolution on groups when the group is the group of n-tuples of integers.

Definition

Problem statement and basics

Similar to the one-dimensional case, an asterisk is used to represent the convolution operation. The number of dimensions in the given operation is reflected in the number of asterisks. For example, an M-dimensional convolution would be written with M asterisks. The following represents a M-dimensional convolution of discrete signals:

[math]\displaystyle{ y(n_1,n_2,...,n_M)=x(n_1,n_2,...,n_M)* \overset{M}{\cdots} *h(n_1,n_2,...,n_M) }[/math]

For discrete-valued signals, this convolution can be directly computed via the following:

[math]\displaystyle{ \sum_{k_1=-\infty}^{\infty} \sum_{k_2=-\infty}^{\infty}...\sum_{k_M=-\infty}^{\infty} h(k_1,k_2,...,k_M)x(n_1-k_1,n_2-k_2,...,n_M-k_M) }[/math]

The resulting output region of support of a discrete multidimensional convolution will be determined based on the size and regions of support of the two input signals.

Visualization of Convolution between two Simple Two-Dimensional Signals

Listed are several properties of the two-dimensional convolution operator. Note that these can also be extended for signals of [math]\displaystyle{ N }[/math]-dimensions.

Commutative Property:

[math]\displaystyle{ x ** h = h ** x }[/math]

Associate Property:

[math]\displaystyle{ (x**h)**g = x**(h**g) }[/math]

Distributive Property:

[math]\displaystyle{ x**(h+g) = (x**h) + (x**g) }[/math]

These properties are seen in use in the figure below. Given some input [math]\displaystyle{ x(n_1, n_2) }[/math] that goes into a filter with impulse response [math]\displaystyle{ h(n_1, n_2) }[/math] and then another filter with impulse response [math]\displaystyle{ g(n_1, n_2) }[/math], the output is given by [math]\displaystyle{ y(n_1, n_2) }[/math]. Assume that the output of the first filter is given by [math]\displaystyle{ w(n_1, n_2) }[/math], this means that:

[math]\displaystyle{ w = x ** h }[/math]

Further, that intermediate function is then convolved with the impulse response of the second filter, and thus the output can be represented by:

[math]\displaystyle{ y = w ** g = (x**h)**g }[/math]

Using the associative property, this can be rewritten as follows:

[math]\displaystyle{ y = x**(h**g) }[/math]

meaning that the equivalent impulse response for a cascaded system is given by:

[math]\displaystyle{ h_{eq} = h**g }[/math]

Both figures represent cascaded systems. Note that the order of the filters does not affect the output.

A similar analysis can be done on a set of parallel systems illustrated below.

A system with a set of parallel filters.

In this case, it is clear that:

[math]\displaystyle{ y = (x**h)+(x**g) }[/math]

Using the distributive law, it is demonstrated that:

[math]\displaystyle{ y = x**(h+g) }[/math]

This means that in the case of a parallel system, the equivalent impulse response is provided by:

[math]\displaystyle{ h_{eq} = h+g }[/math]

The equivalent impulse responses in both cascaded systems and parallel systems can be generalized to systems with [math]\displaystyle{ N }[/math]-number of filters.[1]

Motivation and applications

Convolution in one dimension was a powerful discovery that allowed the input and output of a linear shift-invariant (LSI) system (see LTI system theory) to be easily compared so long as the impulse response of the filter system was known. This notion carries over to multidimensional convolution as well, as simply knowing the impulse response of a multidimensional filter too allows for a direct comparison to be made between the input and output of a system. This is profound since several of the signals that are transferred in the digital world today are of multiple dimensions including images and videos. Similar to the one-dimensional convolution, the multidimensional convolution allows the computation of the output of an LSI system for a given input signal.

For example, consider an image that is sent over some wireless network subject to electro-optical noise. Possible noise sources include errors in channel transmission, the analog to digital converter, and the image sensor. Usually noise caused by the channel or sensor creates spatially-independent, high-frequency signal components that translates to arbitrary light and dark spots on the actual image. In order to rid the image data of the high-frequency spectral content, it can be multiplied by the frequency response of a low-pass filter, which based on the convolution theorem, is equivalent to convolving the signal in the time/spatial domain by the impulse response of the low-pass filter. Several impulse responses that do so are shown below.[2]

Impulse Responses of Typical Multidimensional Low Pass Filters

In addition to filtering out spectral content, the multidimensional convolution can implement edge detection and smoothing. This once again is wholly dependent on the values of the impulse response that is used to convolve with the input image. Typical impulse responses for edge detection are illustrated below.

Typical Impulse Responses for Edge Detection
Original image (left) and image after passing through edge-detecting filter (right)

In addition to image processing, multidimensional convolution can be implemented to enable a variety of other applications. Since filters are widespread in digital communication systems, any system that must transmit multidimensional data is assisted by filtering techniques It is used in real-time video processing, neural network analysis, digital geophysical data analysis, and much more.[3]

One typical distortion that occurs during image and video capture or transmission applications is blur that is caused by a low-pass filtering process. The introduced blur can be modeled using Gaussian low-pass filtering.

Original image (left) and blurred image (right) performed using Gaussian convolution

Row-column decomposition with separable signals

Separable signals

A signal is said to be separable if it can be written as the product of multiple one-dimensional signals.[1] Mathematically, this is expressed as the following:

[math]\displaystyle{ x(n_1,n_2,...,n_M) = x(n_1)x(n_2)...x(n_M) }[/math]

Some readily recognizable separable signals include the unit step function, and the dirac-delta impulse function.

[math]\displaystyle{ u(n_1,n_2,...,n_M)=u(n_1)u(n_2)...u(n_M) }[/math] (unit step function)

[math]\displaystyle{ \delta(n_1,n_2,...,n_M)=\delta(n_1)\delta(n_2)...\delta(n_M) }[/math] (dirac-delta impulse function)

Convolution is a linear operation. It then follows that the multidimensional convolution of separable signals can be expressed as the product of many one-dimensional convolutions. For example, consider the case where x and h are both separable functions.

[math]\displaystyle{ x(n_1,n_2)**h(n_1,n_2)=\sum_{k_1=-\infty}^{\infty} \sum_{k_2=-\infty}^{\infty} h(k_1,k_2)x(n_1-k_1,n_2-k_2) }[/math]

By applying the properties of separability, this can then be rewritten as the following:

[math]\displaystyle{ x(n_1,n_2)**h(n_1,n_2)=\bigg(\sum_{k_1=-\infty}^{\infty} h(k_1)x(n_1-k_1)\bigg)\bigg(\sum_{k_2=-\infty}^{\infty}h(k_2)x(n_2-k_2)\bigg) }[/math]

It is readily seen then that this reduces to the product of one-dimensional convolutions:

[math]\displaystyle{ x(n_1,n_2)**h(n_1,n_2)=\bigg[x(n_1)*h(n_1)\bigg]\bigg[x(n_2)*h(n_2)\bigg] }[/math]

This conclusion can then be extended to the convolution of two separable M-dimensional signals as follows:

[math]\displaystyle{ x(n_1,n_2,...,n_M)* \overset{M}{\cdots} *h(n_1,n_2,...,n_M)=\bigg[x(n_1)*h(n_1)\bigg]\bigg[x(n_2)*h(n_2)\bigg]...\bigg[x(n_M)*h(n_M)\bigg] }[/math]

So, when the two signals are separable, the multidimensional convolution can be computed by computing [math]\displaystyle{ n_M }[/math] one-dimensional convolutions.

Row-column decomposition

The row-column method can be applied when one of the signals in the convolution is separable. The method exploits the properties of separability in order to achieve a method of calculating the convolution of two multidimensional signals that is more computationally efficient than direct computation of each sample (given that one of the signals are separable).[4] The following shows the mathematical reasoning behind the row-column decomposition approach (typically [math]\displaystyle{ h(n_1,n_2) }[/math] is the separable signal):

[math]\displaystyle{ \begin{align} y(n_1,n_2)&=\sum_{k_1=-\infty}^{\infty} \sum_{k_2=-\infty}^{\infty} h(k_1,k_2)x(n_1-k_1,n_2-k_2)\\ &=\sum_{k_1=-\infty}^{\infty} \sum_{k_2=-\infty}^{\infty} h_1(k_1)h_2(k_2)x(n_1-k_1,n_2-k_2)\\ &=\sum_{k_1=-\infty}^{\infty}h_1(k_1)\Bigg[ \sum_{k_2=-\infty}^{\infty} h_2(k_2)x(n_1-k_1,n_2-k_2)\Bigg] \end{align} }[/math]

The value of [math]\displaystyle{ \sum_{k_2=-\infty}^{\infty} h_2(k_2)x(n_1-k_1,n_2-k_2) }[/math] can now be re-used when evaluating other [math]\displaystyle{ y }[/math] values with a shared value of [math]\displaystyle{ n_2 }[/math]:

[math]\displaystyle{ \begin{align} y(n_1+\delta,n_2)&=\sum_{k_1=-\infty}^{\infty}h_1(k_1)\Bigg[ \sum_{k_2=-\infty}^{\infty} h_2(k_2)x(n_1-[k_1-\delta],n_2-k_2)\Bigg]\\ &=\sum_{k_1=-\infty}^{\infty}h_1(k_1+\delta)\Bigg[ \sum_{k_2=-\infty}^{\infty} h_2(k_2)x(n_1-k_1,n_2-k_2)\Bigg] \end{align} }[/math]

Thus, the resulting convolution can be effectively calculated by first performing the convolution operation on all of the rows of [math]\displaystyle{ x(n_1,n_2) }[/math], and then on all of its columns. This approach can be further optimized by taking into account how memory is accessed within a computer processor.

A processor will load in the signal data needed for the given operation. For modern processors, data will be loaded from memory into the processors cache, which has faster access times than memory. The cache itself is partitioned into lines. When a cache line is loaded from memory, multiple data operands are loaded at once. Consider the optimized case where a row of signal data can fit entirely within the processor's cache. This particular processor would be able to access the data row-wise efficiently, but not column-wise since different data operands in the same column would lie on different cache lines.[5] In order to take advantage of the way in which memory is accessed, it is more efficient to transpose the data set and then access it row-wise rather than attempt to access it column-wise. The algorithm then becomes:

  1. Separate the separable two-dimensional signal [math]\displaystyle{ h(n_1,n_2) }[/math] into two one-dimensional signals [math]\displaystyle{ h_1(n_1) }[/math] and [math]\displaystyle{ h_2(n_2) }[/math]
  2. Perform row-wise convolution on the horizontal components of the signal [math]\displaystyle{ x(n_1,n_2) }[/math] using [math]\displaystyle{ h_1(n_1) }[/math] to obtain [math]\displaystyle{ g(n_1,n_2) }[/math]
  3. Transpose the vertical components of the signal [math]\displaystyle{ g(n_1,n_2) }[/math] resulting from Step 2.
  4. Perform row-wise convolution on the transposed vertical components of [math]\displaystyle{ g(n_1,n_2) }[/math] to get the desired output [math]\displaystyle{ y(n_1,n_2) }[/math]

Computational speedup from row-column decomposition

Examine the case where an image of size [math]\displaystyle{ X\times Y }[/math] is being passed through a separable filter of size [math]\displaystyle{ J\times K }[/math]. The image itself is not separable. If the result is calculated using the direct convolution approach without exploiting the separability of the filter, this will require approximately [math]\displaystyle{ XYJK }[/math] multiplications and additions. If the separability of the filter is taken into account, the filtering can be performed in two steps. The first step will have [math]\displaystyle{ XYJ }[/math] multiplications and additions and the second step will have [math]\displaystyle{ XYK }[/math], resulting in a total of [math]\displaystyle{ XYJ+XYK }[/math] or [math]\displaystyle{ XY(J+K) }[/math] multiplications and additions.[6] A comparison of the computational complexity between direct and separable convolution is given in the following image:

Number of computations passing a 10 x 10 Image through a filter of size J x K where J = K varies in size from 1 to 10

Circular convolution of discrete-valued multidimensional signals

The premise behind the circular convolution approach on multidimensional signals is to develop a relation between the Convolution theorem and the Discrete Fourier transform (DFT) that can be used to calculate the convolution between two finite-extent, discrete-valued signals.[7]

Convolution theorem in multiple dimensions

For one-dimensional signals, the Convolution Theorem states that the Fourier transform of the convolution between two signals is equal to the product of the Fourier Transforms of those two signals. Thus, convolution in the time domain is equal to multiplication in the frequency domain. Mathematically, this principle is expressed via the following:[math]\displaystyle{ y(n)=h(n)*x(n)\longleftrightarrow Y(\omega)=H(\omega)X(\omega) }[/math]This principle is directly extendable to dealing with signals of multiple dimensions.[math]\displaystyle{ y(n_1,n_2,...,n_M)=h(n_1,n_2,...,n_M)*\overset{M}{\cdots}*x(n_1,n_2,...,n_M) \longleftrightarrow Y(\omega_1,\omega_2,...,\omega_M)=H(\omega_1,\omega_2,...,\omega_M)X(\omega_1,\omega_2,...,\omega_M) }[/math] This property is readily extended to the usage with the Discrete Fourier transform (DFT) as follows (note that linear convolution is replaced with circular convolution where [math]\displaystyle{ \otimes }[/math] is used to denote the circular convolution operation of size [math]\displaystyle{ N }[/math]):

[math]\displaystyle{ y(n)=h(n)\otimes x(n)\longleftrightarrow Y(k)=H(k)X(k) }[/math]

When dealing with signals of multiple dimensions:[math]\displaystyle{ y(n_1,n_2,...,n_M)=h(n_1,n_2,...,n_M)\otimes\overset{M}{\cdots}\otimes x(n_1,n_2,...,n_M) \longleftrightarrow Y(k_1,k_2,...,k_M)=H(k_1,k_2,...,k_M)X(k_1,k_2,...,k_M) }[/math]The circular convolutions here will be of size [math]\displaystyle{ N_1, N_2,...,N_M }[/math].

Circular convolution approach

The motivation behind using the circular convolution approach is that it is based on the DFT. The premise behind circular convolution is to take the DFTs of the input signals, multiply them together, and then take the inverse DFT. Care must be taken such that a large enough DFT is used such that aliasing does not occur. The DFT is numerically computable when dealing with signals of finite-extent. One advantage this approach has is that since it requires taking the DFT and inverse DFT, it is possible to utilize efficient algorithms such as the Fast Fourier transform (FFT). Circular convolution can also be computed in the time/spatial domain and not only in the frequency domain.

Block diagram of circular convolution with 2 M-dimensional signals

Choosing DFT size to avoid aliasing

Consider the following case where two finite-extent signals x and h are taken. For both signals, there is a corresponding DFT as follows:

[math]\displaystyle{ x(n_1,n_2)\longleftrightarrow X(k_1,k_2) }[/math] and [math]\displaystyle{ h(n_1,n_2) \longleftrightarrow H(k_1,k_2) }[/math]

The region of support of [math]\displaystyle{ x(n_1,n_2) }[/math] is [math]\displaystyle{ 0 \leq n_1 \leq P_1-1 }[/math] and [math]\displaystyle{ 0 \leq n_2 \leq P_2-1 }[/math] and the region of support of [math]\displaystyle{ h(n_1,n_2) }[/math] is [math]\displaystyle{ 0 \leq n_1 \leq Q_1-1 }[/math] and [math]\displaystyle{ 0 \leq n_2 \leq Q_2-1 }[/math].

The linear convolution of these two signals would be given as:[math]\displaystyle{ y_{linear}(n_1,n_2)=\sum_{m_1} \sum_{m_2}h(m_1,m_2)x(n_1-m_1,n_2-m_2) }[/math]Given the regions of support of [math]\displaystyle{ x(n_1,n_2) }[/math] and [math]\displaystyle{ h(n_1,n_2) }[/math], the region of support of [math]\displaystyle{ y_{linear}(n_1,n_2) }[/math] will then be given as the following:

[math]\displaystyle{ 0\leq n_1 \leq P_1 + Q_1 - 1 }[/math][math]\displaystyle{ 0\leq n_2 \leq P_2 + Q_2-1 }[/math]Based on the regions of support of the two signals, a DFT of size [math]\displaystyle{ N_1\times N_2 }[/math] must be used where [math]\displaystyle{ N_1 \geq \max(P_1,Q_1) }[/math] and [math]\displaystyle{ N_2 \geq \max(P_2,Q_2) }[/math] since the same size DFT must be used on both signals. In the event where a DFT size larger than the extent of a signal is needed, the signal is zero-padded until it reaches the required length. After multiplying the DFTs and taking the inverse DFT on the result, the resulting circular convolution is then given by:

[math]\displaystyle{ y_{circular}(n_1,n_2)=\sum_{r_1}\sum_{r_2}\Bigg[\sum_{m_1=0}^{Q_1-1} \sum_{m_2=0}^{Q_2-1}h(m_1,m_2)x(n_1-m_1-r_1N_1,n_2-m_2-r_2N_2)\Bigg] }[/math] for [math]\displaystyle{ (n_1,n_2) \in R_{N_1N_2} }[/math]

[math]\displaystyle{ R_{N_1N_2}\triangleq \{(n_1,n_2):0\leq n_1 \leq N_1-1, 0 \leq n_2 \leq N_2 -1\} }[/math]

The result will be that [math]\displaystyle{ y_{circular}(n_1,n_2) }[/math] will be a spatially aliased version of the linear convolution result [math]\displaystyle{ y_{linear}(n_1,n_2) }[/math]. This can be expressed as the following:

[math]\displaystyle{ y_{circular}(n_1,n_2)=\sum_{r_1} \sum_{r_2} y_{linear}(n_1-r_1N_1, n_2-r_2N_2){\mathrm{\,\,\,for\,\,\,}}(n_1,n_2) \in R_{N_1N_2} }[/math]

Then, in order to avoid aliasing between the spatially aliased replicas, [math]\displaystyle{ N_1 }[/math] and [math]\displaystyle{ N_2 }[/math] must be chosen to satisfy the following conditions:

[math]\displaystyle{ N_1 \geq P_1+Q_1-1 }[/math]

[math]\displaystyle{ N_2 \geq P_2+Q_2-1 }[/math]

If these conditions are satisfied, then the results of the circular convolution will equal that of the linear convolution (taking the main period of the circular convolution as the region of support). That is:

[math]\displaystyle{ y_{circular}(n_1,n_2)=y_{linear}(n_1,n_2) }[/math] for [math]\displaystyle{ (n_1,n_2) \in R_{N_1N_2} }[/math]

Summary of procedure using DFTs

The Convolution theorem and circular convolution can thus be used in the following manner to achieve a result that is equal to performing the linear convolution:[8]

  1. Choose [math]\displaystyle{ N_1 }[/math] and [math]\displaystyle{ N_2 }[/math] to satisfy [math]\displaystyle{ N_1 \geq P_1+Q_1-1 }[/math] and [math]\displaystyle{ N_2 \geq P_2+Q_2-1 }[/math]
  2. Zero pad the signals [math]\displaystyle{ h(n_1,n_2) }[/math] and [math]\displaystyle{ x(n_1,n_2) }[/math] such that they are both [math]\displaystyle{ N_1\times N_2 }[/math] in size
  3. Compute the DFTs of both [math]\displaystyle{ h(n_1,n_2) }[/math] and [math]\displaystyle{ x(n_1,n_2) }[/math]
  4. Multiple the results of the DFTs to obtain [math]\displaystyle{ Y(k_1,k_2)=H(k_1,k_2)X(k_1,k_2) }[/math]
  5. The result of the IDFT of [math]\displaystyle{ Y(k_1,k_2) }[/math] will then be equal to the result of performing linear convolution on the two signals

Overlap and add

Another method to perform multidimensional convolution is the overlap and add approach. This method helps reduce the computational complexity often associated with multidimensional convolutions due to the vast amounts of data inherent in modern-day digital systems.[9] For sake of brevity, the two-dimensional case is used as an example, but the same concepts can be extended to multiple dimensions.

Consider a two-dimensional convolution using a direct computation:

[math]\displaystyle{ y(n_1, n_2) = \sum_{k_1=-\infty}^{\infty} \sum_{k_2=-\infty}^{\infty} x(n_1 - k_1, n_2 - k_2)h(k_1, k_2) }[/math]

Assuming that the output signal [math]\displaystyle{ y(n_1, n_2) }[/math] has N nonzero coefficients, and the impulse response has M nonzero samples, this direct computation would need MN multiplies and MN - 1 adds in order to compute. Using an FFT instead, the frequency response of the filter and the Fourier transform of the input would have to be stored in memory.[10] Massive amounts of computations and excessive use of memory storage space pose a problematic issue as more dimensions are added. This is where the overlap and add convolution method comes in.

Decomposition into smaller convolution blocks

Instead of performing convolution on the blocks of information in their entirety, the information can be broken up into smaller blocks of dimensions [math]\displaystyle{ L_1 }[/math]x[math]\displaystyle{ L_2 }[/math] resulting in smaller FFTs, less computational complexity, and less storage needed. This can be expressed mathematically as follows:

[math]\displaystyle{ x(n_1, n_2) = \sum_{i=1}^{P_1} \sum_{j=1}^{P_2}x_{ij}(n_1, n_2) }[/math]

where [math]\displaystyle{ x(n_1, n_2) }[/math] represents the [math]\displaystyle{ N_1 }[/math]x[math]\displaystyle{ N_2 }[/math] input signal, which is a summation of [math]\displaystyle{ P_1P_2 }[/math] block segments, with [math]\displaystyle{ P_1 = N_1/L_1 }[/math] and [math]\displaystyle{ P_2 = N_2/L_2 }[/math].

To produce the output signal, a two-dimensional convolution is performed:

[math]\displaystyle{ y(n_1,n_2) = x(n_1, n_2) ** h(n_1, n_2) }[/math]

Substituting in for [math]\displaystyle{ x(n_1, n_2) }[/math] results in the following:

[math]\displaystyle{ y(n_1,n_2) = \sum_{i=1}^{P_1} \sum_{j=1}^{P_2}x_{ij}(n_1, n_2)** h(n_1, n_2) }[/math]

This convolution adds more complexity than doing a direct convolution; however, since it is integrated with an FFT fast convolution, overlap-add performs faster and is a more memory-efficient method, making it practical for large sets of multidimensional data.

Breakdown of procedure

Let [math]\displaystyle{ h(n_1, n_2) }[/math] be of size [math]\displaystyle{ M_1 \times M_2 }[/math]:

  1. Break input [math]\displaystyle{ x(n_1, n_2) }[/math] into non-overlapping blocks of dimensions [math]\displaystyle{ L_1 \times L_2 }[/math].
  2. Zero pad [math]\displaystyle{ h(n_1, n_2) }[/math] such that it has dimensions ([math]\displaystyle{ L_1 + M_1 - 1 }[/math]) [math]\displaystyle{ \times }[/math] ([math]\displaystyle{ L_2 + M_2 - 1 }[/math]).
  3. Use DFT to get [math]\displaystyle{ H(k_1, k_2) }[/math].
  4. For each input block:
    1. Zero pad [math]\displaystyle{ x_{ij}(n_1, n_2) }[/math] to be of dimensions ([math]\displaystyle{ L_1 + M_1 - 1 }[/math]) [math]\displaystyle{ \times }[/math] ([math]\displaystyle{ L_2 + M_2 - 1 }[/math]).
    2. Take discrete Fourier transform of each block to give [math]\displaystyle{ X_{ij}(k_1, k_2) }[/math].
    3. Multiply to get [math]\displaystyle{ Y_{ij}(k_1, k_2) = X_{ij}(k_1, k_2)H(k_1,k_2) }[/math].
    4. Take inverse discrete Fourier transform of [math]\displaystyle{ Y_{ij}(k_1, k_2) }[/math] to get [math]\displaystyle{ y_{ij}(n_1, n_2) }[/math].
  5. Find [math]\displaystyle{ y(n_1, n_2) }[/math] by overlap and adding the last [math]\displaystyle{ (M_1 - 1) }[/math][math]\displaystyle{ \times }[/math] [math]\displaystyle{ (M_2 - 1) }[/math] samples of [math]\displaystyle{ y_{ij}(n_1, n_2) }[/math] with the first [math]\displaystyle{ (M_1 - 1) }[/math] [math]\displaystyle{ \times }[/math][math]\displaystyle{ (M_2 - 1) }[/math] samples of [math]\displaystyle{ y_{i+1,j+1}(n_1, n_2) }[/math] to get the result.[11]

Pictorial method of operation

In order to visualize the overlap-add method more clearly, the following illustrations examine the method graphically. Assume that the input [math]\displaystyle{ x(n_1, n_2) }[/math] has a square region support of length N in both vertical and horizontal directions as shown in the figure below. It is then broken up into four smaller segments in such a way that it is now composed of four smaller squares. Each block of the aggregate signal has dimensions [math]\displaystyle{ (N/2) }[/math] [math]\displaystyle{ \times }[/math] [math]\displaystyle{ (N/2) }[/math].

Decomposed Input Signal

Then, each component is convolved with the impulse response of the filter. Note that an advantage for an implementation such as this can be visualized here since each of these convolutions can be parallelized on a computer, as long as the computer has sufficient memory and resources to store and compute simultaneously.

In the figure below, the first graph on the left represents the convolution corresponding to the component of the input [math]\displaystyle{ x_{0,0} }[/math] with the corresponding impulse response [math]\displaystyle{ h(n_1,n_2) }[/math]. To the right of that, the input [math]\displaystyle{ x_{1,0} }[/math] is then convolved with the impulse response [math]\displaystyle{ h(n_1,n_2) }[/math].

Individual Component Convolution with Impulse Response
Convolution of each Component with the Overlap Portions Highlighted

The same process is done for the other two inputs respectively, and they are accumulated together in order to form the convolution. This is depicted to the left.

Assume that the filter impulse response [math]\displaystyle{ h(n_1,n_2) }[/math] has a region of support of [math]\displaystyle{ (N/8) }[/math] in both dimensions. This entails that each convolution convolves signals with dimensions [math]\displaystyle{ (N/2) }[/math] [math]\displaystyle{ \times }[/math] [math]\displaystyle{ (N/8) }[/math] in both [math]\displaystyle{ n_1 }[/math] and [math]\displaystyle{ n_2 }[/math] directions, which leads to overlap (highlighted in blue) since the length of each individual convolution is equivalent to:

[math]\displaystyle{ (N/2) }[/math] [math]\displaystyle{ + }[/math][math]\displaystyle{ (N/8) }[/math] [math]\displaystyle{ - }[/math][math]\displaystyle{ 1 }[/math] = [math]\displaystyle{ (5/8)N-1 }[/math]

in both directions. The lighter blue portion correlates to the overlap between two adjacent convolutions, whereas the darker blue portion correlates to overlap between all four convolutions. All of these overlap portions are added together in addition to the convolutions in order to form the combined convolution [math]\displaystyle{ y(n_1,n_2) }[/math].[12]

Overlap and save

The overlap and save method, just like the overlap and add method, is also used to reduce the computational complexity associated with discrete-time convolutions. This method, coupled with the FFT, allows for massive amounts of data to be filtered through a digital system while minimizing the necessary memory space used for computations on massive arrays of data.

Comparison to overlap and add

The overlap and save method is very similar to the overlap and add methods with a few notable exceptions. The overlap-add method involves a linear convolution of discrete-time signals, whereas the overlap-save method involves the principle of circular convolution. In addition, the overlap and save method only uses a one-time zero padding of the impulse response, while the overlap-add method involves a zero-padding for every convolution on each input component. Instead of using zero padding to prevent time-domain aliasing like its overlap-add counterpart, overlap-save simply discards all points of aliasing, and saves the previous data in one block to be copied into the convolution for the next block.

In one dimension, the performance and storage metric differences between the two methods is minimal. However, in the multidimensional convolution case, the overlap-save method is preferred over the overlap-add method in terms of speed and storage abilities.[13] Just as in the overlap and add case, the procedure invokes the two-dimensional case but can easily be extended to all multidimensional procedures.

Breakdown of procedure

Let [math]\displaystyle{ h(n_1, n_2) }[/math] be of size [math]\displaystyle{ M_1 \times M_2 }[/math]:

  1. Insert [math]\displaystyle{ (M_1 - 1) }[/math] columns and [math]\displaystyle{ (M_2 - 1) }[/math] rows of zeroes at the beginning of the input signal [math]\displaystyle{ x(n_1,n_2) }[/math] in both dimensions.
  2. Split the corresponding signal into overlapping segments of dimensions ([math]\displaystyle{ L_1 + M_1 - 1 }[/math])[math]\displaystyle{ \times }[/math]([math]\displaystyle{ L_2 + M_2 - 1 }[/math]) in which each two-dimensional block will overlap by [math]\displaystyle{ (M_1 - 1) }[/math] [math]\displaystyle{ \times }[/math] [math]\displaystyle{ (M_2 - 1) }[/math].
  3. Zero pad [math]\displaystyle{ h(n_1, n_2) }[/math] such that it has dimensions ([math]\displaystyle{ L_1 + M_1 - 1 }[/math])[math]\displaystyle{ \times }[/math]([math]\displaystyle{ L_2 + M_2 - 1 }[/math]).
  4. Use DFT to get [math]\displaystyle{ H(k_1, k_2) }[/math].
  5. For each input block:
    1. Take discrete Fourier transform of each block to give [math]\displaystyle{ X_{ij}(k_1, k_2) }[/math].
    2. Multiply to get [math]\displaystyle{ Y_{ij}(k_1, k_2) = X_{ij}(k_1, k_2)H(k_1,k_2) }[/math].
    3. Take inverse discrete Fourier transform of [math]\displaystyle{ Y_{ij}(k_1, k_2) }[/math] to get [math]\displaystyle{ y_{ij}(n_1, n_2) }[/math].
    4. Get rid of the first [math]\displaystyle{ (M_1 - 1) }[/math][math]\displaystyle{ \times }[/math][math]\displaystyle{ (M_2 - 1) }[/math] for each output block [math]\displaystyle{ y_{ij}(n_1, n_2) }[/math].
  6. Find [math]\displaystyle{ y(n_1, n_2) }[/math] by attaching the last [math]\displaystyle{ (L_1\times L_2) }[/math] samples for each output block [math]\displaystyle{ y_{ij}(n_1, n_2) }[/math].[11]

The helix transform

Similar to row-column decomposition, the helix transform computes the multidimensional convolution by incorporating one-dimensional convolutional properties and operators. Instead of using the separability of signals, however, it maps the Cartesian coordinate space to a helical coordinate space allowing for a mapping from a multidimensional space to a one-dimensional space.

Multidimensional convolution with one-dimensional convolution methods

To understand the helix transform, it is useful to first understand how a multidimensional convolution can be broken down into a one-dimensional convolution. Assume that the two signals to be convolved are [math]\displaystyle{ X_{M \times N} }[/math] and [math]\displaystyle{ Y_{K \times L} }[/math], which results in an output [math]\displaystyle{ Z_{(M - K + 1)\times(N - L + 1)} }[/math]. This is expressed as follows:

[math]\displaystyle{ Z(i,j) = \sum_{m=0}^{M-1}\sum_{n=0}^{N-1}X(m,n)Y(i-m, j-n) }[/math]

Next, two matrices are created that zero pad each input in both dimensions such that each input has equivalent dimensions, i.e.

[math]\displaystyle{ \mathbf{X'} = \begin{bmatrix} X & 0 \\ 0 & 0 \\ \end{bmatrix} }[/math] and [math]\displaystyle{ \mathbf{Y'} = \begin{bmatrix} Y & 0 \\ 0 & 0 \\ \end{bmatrix} }[/math]

where each of the input matrices are now of dimensions [math]\displaystyle{ (M+K-1) }[/math][math]\displaystyle{ \times }[/math][math]\displaystyle{ (N+L-1) }[/math]. It is then possible to implement column-wise lexicographic ordering in order to convert the modified matrices into vectors, [math]\displaystyle{ X'' }[/math] and [math]\displaystyle{ Y'' }[/math]. In order to minimize the number of unimportant samples in each vector, each vector is truncated after the last sample in the original matrices [math]\displaystyle{ X }[/math] and [math]\displaystyle{ Y }[/math] respectively. Given this, the length of vector [math]\displaystyle{ X'' }[/math] and [math]\displaystyle{ Y'' }[/math] are given by:

[math]\displaystyle{ l_{X''} = }[/math] [math]\displaystyle{ (M+K-1) }[/math][math]\displaystyle{ \times }[/math][math]\displaystyle{ (N-1) }[/math] + [math]\displaystyle{ M }[/math]

[math]\displaystyle{ l_{Y''} = }[/math][math]\displaystyle{ (M+K-1) }[/math][math]\displaystyle{ \times }[/math][math]\displaystyle{ (L-1) }[/math] + [math]\displaystyle{ K }[/math]

The length of the convolution of these two vectors, [math]\displaystyle{ Z'' }[/math], can be derived and shown to be:

[math]\displaystyle{ l_{Z''} = }[/math] [math]\displaystyle{ l_{Y''} + }[/math][math]\displaystyle{ l_{X''} }[/math] [math]\displaystyle{ = (M+K-1) }[/math][math]\displaystyle{ \times }[/math][math]\displaystyle{ (N+L-1) }[/math]

This vector length is equivalent to the dimensions of the original matrix output [math]\displaystyle{ Z }[/math], making converting back to a matrix a direct transformation. Thus, the vector, [math]\displaystyle{ Z'' }[/math], is converted back to matrix form, which produces the output of the two-dimensional discrete convolution.[14]

Filtering on a helix

When working on a two-dimensional Cartesian mesh, a Fourier transform along either axes will result in the two-dimensional plane becoming a cylinder as the end of each column or row attaches to its respective top forming a cylinder. Filtering on a helix behaves in a similar fashion, except in this case, the bottom of each column attaches to the top of the next column, resulting in a helical mesh. This is illustrated below. The darkened tiles represent the filter coefficients.

Transformation from a 2D Cartesian Filtering Plane to a Helix Filter.

If this helical structure is then sliced and unwound into a one-dimensional strip, the same filter coefficients on the 2-d Cartesian plane will match up with the same input data, resulting in an equivalent filtering scheme. This ensures that a two-dimensional convolution will be able to be performed by a one-dimensional convolution operator as the 2D filter has been unwound to a 1D filter with gaps of zeroes separating the filter coefficients.

One-Dimensional Filtering Strip after being Unwound.

Assuming that some-low pass two-dimensional filter was used, such as:

0 -1 0
-1 4 -1
0 -1 0

Then, once the two-dimensional space was converted into a helix, the one-dimensional filter would look as follows:

[math]\displaystyle{ h(n) = -1, 0, ... , 0, -1, 4, -1, 0, ..., 0, -1, 0, ... }[/math]

Notice in the one-dimensional filter that there are no leading zeroes as illustrated in the one-dimensional filtering strip after being unwound. The entire one-dimensional strip could have been convolved with; however, it is less computationally expensive to simply ignore the leading zeroes. In addition, none of these backside zero values will need to be stored in memory, preserving precious memory resources.[15]

Applications

Helix transformations to implement recursive filters via convolution are used in various areas of signal processing. Although frequency domain Fourier analysis is effective when systems are stationary, with constant coefficients and periodically-sampled data, it becomes more difficult in unstable systems. The helix transform enables three-dimensional post-stack migration processes that can process data for three-dimensional variations in velocity.[15] In addition, it can be applied to assist with the problem of implicit three-dimensional wavefield extrapolation.[16] Other applications include helpful algorithms in seismic data regularization, prediction error filters, and noise attenuation in geophysical digital systems.[14]

Gaussian convolution

One application of multidimensional convolution that is used within signal and image processing is Gaussian convolution. This refers to convolving an input signal with the Gaussian distribution function.

2D Gaussian Visualization where [math]\displaystyle{ \mu_1=\mu_2=0 }[/math] and [math]\displaystyle{ \sigma_1=\sigma_2=1 }[/math]

The Gaussian distribution sampled at discrete values in one dimension is given by the following (assuming [math]\displaystyle{ \mu=0 }[/math]):[math]\displaystyle{ G(n)=\frac{1}{\sqrt{2\pi\sigma^2}}e^{-\frac{n^2}{2\sigma^2}} }[/math]This is readily extended to a signal of M dimensions (assuming [math]\displaystyle{ \sigma }[/math] stays constant for all dimensions and [math]\displaystyle{ \mu_1=\mu_2=...=\mu_M=0 }[/math]):[math]\displaystyle{ G(n_1,n_2,...,n_M)=\frac{1}{(2\pi)^{M/2}\sigma^M}e^{-\frac{({n_1}^2+{n_2}^2+...+{n_M}^2)}{2\sigma^2}} }[/math]One important property to recognize is that the M dimensional signal is separable such that:[math]\displaystyle{ G(n_1,n_2,...,n_M)=G(n_1)G(n_2)...G(n_M) }[/math]Then, Gaussian convolution with discrete-valued signals can be expressed as the following:

[math]\displaystyle{ y(n)=x(n)*G(n) }[/math]

[math]\displaystyle{ y(n_1,n_2,...,n_M)=x(n_1,n_2,...,n_M)*...*G(n_1,n_2,...,n_M) }[/math]

Approximation by FIR filter

Gaussian convolution can be effectively approximated via implementation of a Finite impulse response (FIR) filter. The filter will be designed with truncated versions of the Gaussian. For a two-dimensional filter, the transfer function of such a filter would be defined as the following:[17]

[math]\displaystyle{ H(z_1,z_2)=\frac{1}{s(r_1,r_2)} \sum_{n_1=-r_1}^{r_1}\sum_{n_2=-r_2}^{r_2}G(n_1,n_2){z_1}^{-n_1}{z_2}^{-n_2} }[/math]

where

[math]\displaystyle{ s(r_1,r_2)=\sum_{n_1=-r_1}^{r_1}\sum_{n_2=-r_2}^{r_2}G(n_1,n_2) }[/math]

Choosing lower values for [math]\displaystyle{ r_1 }[/math] and [math]\displaystyle{ r_2 }[/math] will result in performing less computations, but will yield a less accurate approximation while choosing higher values will yield a more accurate approximation, but will require a greater number of computations.

Approximation by box filter

Another method for approximating Gaussian convolution is via recursive passes through a box filter. For approximating one-dimensional convolution, this filter is defined as the following:[17]

[math]\displaystyle{ H(z)=\frac{1}{2r+1} \frac{z^r-z^{-r-1}}{1-z^-1} }[/math]

Typically, recursive passes 3, 4, or 5 times are performed in order to obtain an accurate approximation.[17] A suggested method for computing r is then given as the following:[18]

[math]\displaystyle{ \sigma^2=\frac{1}{12}K((2r+1)^2-1) }[/math] where K is the number of recursive passes through the filter.

Then, since the Gaussian distribution is separable across different dimensions, it follows that recursive passes through one-dimensional filters (isolating each dimension separately) will thus yield an approximation of the multidimensional Gaussian convolution. That is, M-dimensional Gaussian convolution could be approximated via recursive passes through the following one-dimensional filters:

[math]\displaystyle{ H(z_1)=\frac{1}{2r_1+1} \frac{{z_1}^{r_1}-{z_1}^{-r_1-1}}{1-{z_1}^-1} }[/math]

[math]\displaystyle{ H(z_2)=\frac{1}{2r_2+1} \frac{{z_2}^{r_2}-{z_2}^{-r_2-1}}{1-{z_2}^-1} }[/math]

[math]\displaystyle{ \vdots }[/math]

[math]\displaystyle{ H(z_M)=\frac{1}{2r_M+1} \frac{{z_M}^{r_M}-{z_M}^{-r_M-1}}{1-{z_M}^-1} }[/math]

Applications

Gaussian convolutions are used extensively in signal and image processing. For example, image-blurring can be accomplished with Gaussian convolution where the [math]\displaystyle{ \sigma }[/math] parameter will control the strength of the blurring. Higher values would thus correspond to a more blurry end result.[19] It is also commonly used in Computer vision applications such as Scale-invariant feature transform (SIFT) feature detection.[20]

See also

References

  1. 1.0 1.1 Dudgeon, Dan; Mersereau, Russell (1983), Multidimensional Digital Signal Processing, Prentice-Hall, pp. 21–22 
  2. "MARBLE: Interactive Vision". http://homepages.inf.ed.ac.uk/rbf/CVonline/LOCAL_COPIES/MARBLE/. 
  3. "Digital Geophysical Analysis Redesign". http://www-rohan.sdsu.edu/~jiracek/DAGSAW/4.1.html. 
  4. Sihvo, Tero; Niittylahti, Jarkko (5 June 2005). "Row-Column Decomposition Based 2D Transform Optimization on Subword Parallel Processors". International Symposium on Signals, Circuits and Systems, 2005. ISSCS 2005. 1. pp. 99–102. doi:10.1109/ISSCS.2005.1509860. ISBN 978-0-7803-9029-4. 
  5. "Introduction to Caches". http://www.cs.umd.edu/class/sum2003/cmsc311/Notes/Memory/introCache.html. 
  6. Eddins, Steve. "Separable Convolution". http://blogs.mathworks.com/steve/2006/10/04/separable-convolution/. 
  7. Dudgeon, Dan; Mersereau, Russell (1983), Multidimensional Digital Signal Processing, Prentice-Hall, p. 70 
  8. Dudgeon, Dan; Mersereau, Russell (1983), Multidimensional Digital Signal Processing, Prentice-Hall, p. 72 
  9. Fernandez, Joseph; Kumar, Vijaya (2013). Multidimensional Overlap-Add and Overlap-Save for Correlation and Convolution. pp. 509–513. doi:10.1109/ICIP.2013.6738105. ISBN 978-1-4799-2341-0. 
  10. "2D Signal Processing". Dublin City University. p. 24. http://www.eeng.dcu.ie/~ee502/EE502s4.pdf. 
  11. 11.0 11.1 Kundur, Deepa. "Overlap-Save and Overlap-Add". University of Toronto. http://www.comm.utoronto.ca/~dkundur/course_info/real-time-DSP/notes/8_Kundur_Overlap_Save_Add.pdf. 
  12. "2D Signal Processing". Dublin City University. p. 26. http://www.eeng.dcu.ie/~ee502/EE502s4.pdf. 
  13. Kim, Chang; Strintzis, Michael (May 1980). "High-Speed Multidimensional Convolution". IEEE Transactions on Pattern Analysis and Machine Intelligence PAMI-2 (3): 269–273. doi:10.1109/tpami.1980.4767017. 
  14. 14.0 14.1 Naghizadeh, Mostafa; Sacchi, Mauricio (November 2009). "Multidimensional convolution via a 1D convolution algorithm". The Leading Edge. https://www.researchgate.net/publication/274360447. 
  15. 15.0 15.1 Claerbout, Jon (September 1998). "Multidimensional recursive filters via a helix". Geophysics 63 (5): 9. doi:10.1190/1.1444449. Bibcode1998Geop...63.1532C. 
  16. Fomel, Sergey; Claerbout, Jon (1997). "Exploring three-dimensional implicit wavefield extrapolation with the helix transform". SEP Report: 43–60. https://pdfs.semanticscholar.org/5993/a76fdb37d3b1a3dfba795d6ed596c608cec9.pdf. 
  17. 17.0 17.1 17.2 Getreuer, Pascal (2013). "A Survey of Gaussian Convolution Algorithms". Image Processing on Line 3: 286–310. doi:10.5201/ipol.2013.87. 
  18. Wells, W.M. (1986). "Efficient synthesis of Gaussian filters by cascaded uniform filters". IEEE Transactions on Pattern Analysis and Machine Intelligence PAMI-8 (2): 234–239. doi:10.1109/TPAMI.1986.4767776. 
  19. "Gaussian Blur - Image processing for scientists and engineers, Part 4". http://patrick-fuller.com/gaussian-blur-image-processing-for-scientists-and-engineers-part-4/. 
  20. Lowe, D.G. (1999). "Object recognition from local scale-invariant features". Proceedings of the International Conference on Computer Vision 2: 1150–1157. http://www.cs.ubc.ca/~lowe/papers/iccv99.pdf.