Content deleted Content added
10.1109/tpami.1980.4767017 |
|||
(32 intermediate revisions by 28 users not shown) | |||
Line 1:
{{Short description|Mathematical operation in signal processing}}
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 [[convolution#Domain of definition|multidimensional convolution]] of functions on [[Euclidean space]]. It is also a special case of [[convolution#Convolutions on groups|convolution on groups]] when the [[group (mathematics)|group]] is the group of ''n''-tuples of integers.
==Definition==
===Problem
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:
Line 44 ⟶ 45:
<math>h_{eq} = h**g</math>
[[File:Cascaded.png|none|thumb|272x272px|Both figures represent cascaded systems. Note that the order of the filters does not
A similar analysis can be done on a set of parallel systems illustrated below.
Line 64 ⟶ 65:
The equivalent impulse responses in both cascaded systems and parallel systems can be generalized to systems with <math>N</math>-number of filters.<ref name=":4" />
===Motivation
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]])
For example, consider an image that is sent over some wireless network subject to
[[File:Screen Shot 2015-11-11 at 11.18.23 PM.png|none|thumb|311x311px|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.
[[File:Screen Shot 2015-11-11 at 11.21.00 PM.png|none|thumb|Typical Impulse Responses for Edge Detection]]
Line 78 ⟶ 79:
[[File:edge_detection2.png|500px|thumb|Original image (left) and image after passing through edge-detecting filter (right)|none]]
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.<ref>{{Cite web|title = Digital Geophysical Analysis Redesign|url = http://www-rohan.sdsu.edu/~jiracek/DAGSAW/4.1.html|website = www-rohan.sdsu.edu|
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.
Line 84 ⟶ 85:
[[File:Wiki image blur example.png|500px|thumb|Original image (left) and blurred image (right) performed using Gaussian convolution|none]]
==Row-
===Separable
A signal is said to be '''separable''' if it can be written as the product of multiple one-dimensional signals.<ref name=":4">{{citation |last1 = Dudgeon|first1 = Dan|last2 = Mersereau|first2 = Russell|title = Multidimensional Digital Signal Processing|publisher = Prentice-Hall|year = 1983|pages = 21–22}}</ref> Mathematically, this is expressed as the following:
Line 92 ⟶ 93:
<math>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
<math>u(n_1,n_2,...,n_M)=u(n_1)u(n_2)...u(n_M)</math> (unit step function)
<math>\delta(n_1,n_2,...,n_M)=\delta(n_1)\delta(n_2)...\delta(n_M)</math> (
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.
Line 104 ⟶ 105:
By applying the properties of separability, this can then be rewritten as the following:
<math>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(
It is readily seen then that this reduces to the product of one-dimensional convolutions:
Line 112 ⟶ 113:
This conclusion can then be extended to the convolution of two separable ''M''-dimensional signals as follows:
<math>x(n_1,n_2,...,n_M)* \overset{M}{\cdots} *h(n_1,n_2,...,n_M)=\bigg[x(n_1)*h(
So, when the two signals are separable, the multidimensional convolution can be computed by computing <math>n_M</math> one-dimensional convolutions.
===Row-
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).<ref>{{cite
<math>
<math>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)</math>▼
\begin{align}
▲
\end{align}
</math>
The value of <math>\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>y</math> values with a shared value of <math>n_2</math>:
<math>
\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>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.<ref>{{cite web|title=Introduction to Caches|url=http://www.cs.umd.edu/class/sum2003/cmsc311/Notes/Memory/introCache.html|website=Computer Science University of Maryland|
# Separate the separable two-dimensional signal <math>h(n_1,n_2)</math> into two one-dimensional signals <math>h_1(n_1)</math> and <math>h_2(n_2)</math>
# Perform row-wise convolution on the horizontal components of the signal <math>x(n_1,n_2)</math> using <math>h_1(n_1)</math> to obtain <math>g(n_1,n_2)</math>
Line 133 ⟶ 148:
# Perform row-wise convolution on the transposed vertical components of <math>g(n_1,n_2)</math> to get the desired output <math>y(n_1,n_2)</math>
===Computational
Examine the case where an image of size <math>X\times Y</math> is being passed through a separable filter of size <math>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>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>XYJ</math> multiplications and additions and the second step will have <math>XYK</math>, resulting in a total of <math>XYJ+XYK</math> or <math>XY(J+K)</math> multiplications and additions.<ref>{{cite web|last1=Eddins|first1=Steve|title=Separable Convolution|url=http://blogs.mathworks.com/steve/2006/10/04/separable-convolution/|website=Mathwords|
[[File:Picture2 wiki.png|thumb|400px|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''|none]]
==Circular
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.<ref>{{citation | last1=Dudgeon | first1=Dan | last2=Mersereau | first2=Russell | title=Multidimensional Digital Signal Processing | publisher=Prentice-Hall | year=1983 | page=70}}</ref>
===Convolution
For one-dimensional signals, the [[Convolution theorem|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 display="block">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 display="block">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>\otimes</math> is used to denote the circular convolution operation of size <math>N</math>):
<math>y(n)=h(n)\otimes x(n)\longleftrightarrow Y(k)=H(k)X(k)</math>
Line 149 ⟶ 164:
When dealing with signals of multiple dimensions:<math display="block">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>N_1, N_2,...,N_M</math>.
===Circular
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.
Line 155 ⟶ 170:
[[File:Wiki circular conv.png|thumb|600px|Block diagram of circular convolution with 2 ''M''-dimensional signals|none]]
===Choosing DFT size to avoid
Consider the following case where two finite-extent signals ''x'' and ''h'' are taken. For both signals, there is a corresponding DFT as follows:
Line 185 ⟶ 200:
<math>y_{circular}(n_1,n_2)=y_{linear}(n_1,n_2)</math> for <math>(n_1,n_2) \in R_{N_1N_2}</math>
===Summary of
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:<ref>{{citation | last1=Dudgeon | first1=Dan | last2=Mersereau | first2=Russell | title=Multidimensional Digital Signal Processing | publisher=Prentice-Hall | year=1983 | page=72}}</ref>
# Choose <math>N_1</math> and <math>N_2</math> to satisfy <math>N_1 \geq P_1+Q_1-1</math> and <math>N_2 \geq P_2+Q_2-1</math>
# Zero pad the signals <math>h(n_1,n_2)</math> and <math>x(n_1,n_2)</math> such that they are both <math>N_1\times N_2</math> in size
# Compute the DFTs of both <math>h(n_1,n_2)</math> and <math>x(n_1,n_2)</math>
#
# The result of the IDFT of <math>Y(k_1,k_2)</math> will then be equal to the result of performing linear convolution on the two signals
==Overlap and
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.<ref>{{cite
Consider a two-dimensional convolution using a direct computation:
Line 201 ⟶ 216:
<math>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>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.<ref>{{Cite web|url = http://www.eeng.dcu.ie/~ee502/EE502s4.pdf|title = 2D Signal Processing|access-date
===Decomposition into
Instead of performing convolution on the blocks of information in their entirety, the information can be broken up into smaller blocks of dimensions <math>L_1</math>x<math>L_2
</math> resulting in smaller FFTs, less computational complexity, and less storage needed. This can be expressed mathematically as follows:
Line 224 ⟶ 239:
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
Let <math>h(n_1, n_2)</math> be of size <math>M_1 \times M_2</math>:
# Break input <math>x(n_1, n_2)</math> into non-overlapping blocks of dimensions <math>L_1 \times L_2</math>.
Line 234 ⟶ 249:
## Multiply to get <math>Y_{ij}(k_1, k_2) = X_{ij}(k_1, k_2)H(k_1,k_2)</math>.
## Take inverse discrete Fourier transform of <math>Y_{ij}(k_1, k_2)</math> to get <math>y_{ij}(n_1, n_2)</math>.
# Find <math>y(n_1, n_2)</math> by overlap and adding the last <math>(M_1 - 1)</math><math>\times</math> <math>(M_2 - 1)</math> samples of <math>y_{ij}(n_1, n_2)</math> with the first <math>(M_1 - 1)</math> <math>\times</math><math>(M_2 - 1)</math> samples of <math>y_{i+1,j+1}(n_1, n_2)</math> to get the result.<ref name=":3">{{Cite web|url = http://www.comm.utoronto.ca/~dkundur/course_info/real-time-DSP/notes/8_Kundur_Overlap_Save_Add.pdf|title = Overlap-Save and Overlap-Add|access-date
===Pictorial
In order to visualize the overlap-add method more clearly, the following illustrations examine the method graphically. Assume that the input <math>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>(N/2)</math> <math>\times</math> <math>(N/2)</math>. [[File:X signal decomposed.png|thumb|Decomposed Input Signal|none]]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.
Line 249 ⟶ 264:
<math>(N/2)</math> <math>+</math><math>(N/8)</math> <math>-</math><math>1</math> = <math>(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>y(n_1,n_2)</math>.<ref>{{Cite web|url = http://www.eeng.dcu.ie/~ee502/EE502s4.pdf|title = 2D Signal Processing|access-date
==Overlap and
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
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.<ref>{{Cite journal
===Breakdown of
Let <math>h(n_1, n_2)</math> be of size <math>M_1 \times M_2 </math>:
# Insert <math>(M_1 - 1)</math> columns and <math>(M_2 - 1)</math> rows of zeroes at the beginning of the input signal <math>x(n_1,n_2)</math> in both dimensions.
Line 272 ⟶ 287:
# Find <math>y(n_1, n_2)</math> by attaching the last <math>(L_1\times L_2)</math> samples for each output block <math>y_{ij}(n_1, n_2)</math>.<ref name=":3" />
==The
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
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>X_{
<math>Z(i,j) = \sum_{m=0}^{M-1}\sum_{n=0}^{N-1}X(m,n)Y(i-m, j-n)</math>
Line 302 ⟶ 317:
<math>l_{Z''} =</math> <math>l_{Y''} +</math><math>l_{X''}</math> <math>= (M+K-1)</math><math>\times</math><math>(N+L-1)</math>
===Filtering on a
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.
Line 327 ⟶ 342:
Then, once the two-dimensional space was converted into a helix, the one-dimensional filter would look as follows:
<math> 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.<ref name=":2">{{Cite journal
===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.<ref name=":2" /> In addition, it can be applied to assist with the problem of implicit three-dimensional wavefield extrapolation.<ref>{{Cite journal
==Gaussian
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.
Line 345 ⟶ 360:
<math>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
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:<ref name=":0">{{cite journal|last1=Getreuer|first1=Pascal|title=A Survey of Gaussian Convolution Algorithms|journal=Image Processing
<math>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>
Line 357 ⟶ 372:
Choosing lower values for <math>r_1</math> and <math>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
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:<ref name=":0" />
Line 363 ⟶ 378:
<math>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.<ref name=":0" /> A suggested method for computing ''r'' is then given as the following:<ref>{{Cite journal|title = Efficient synthesis of Gaussian filters by cascaded uniform filters|last = Wells|first = W.M.|date = 1986|journal = IEEE Transactions on Pattern Analysis and Machine Intelligence|doi = 10.1109/TPAMI.1986.4767776|
<math>\sigma^2=\frac{1}{12}K((2r+1)^2-1)</math> where ''K'' is the number of recursive passes through the filter.
Line 378 ⟶ 393:
===Applications===
Gaussian convolutions are used extensively in signal and image processing. For example, image-blurring can be accomplished with Gaussian convolution where the <math>\sigma</math> parameter will control the strength of the blurring. Higher values would thus correspond to a more blurry end result.<ref>{{Cite web|title = Gaussian Blur - Image processing for scientists and engineers, Part 4|url = http://patrick-fuller.com/gaussian-blur-image-processing-for-scientists-and-engineers-part-4/|website = patrick-fuller.com|
==See also==
* [[Convolution]]
* [[
* [[Signal processing]]
|