Multidimensional discrete convolution: Difference between revisions

Content deleted Content added
Ssow3 (talk | contribs)
 
(40 intermediate revisions by 31 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 Statementstatement &and Basicsbasics===
 
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 29 ⟶ 30:
<math>x**(h+g) = (x**h) + (x**g)</math>
 
These properties are seen in use in the figure below. Given some input <math>x(n_1, n_2)</math> that goes into a filter with impulse response <math>h(n_1, n_2)</math> and then another filter with impulse response <math>g(n_1, n_2)</math>, the output is given by <math>y(n_1, n_2)</math>. Assume that the output of the first filter is given by <math>w(n_1, n_2)</math>, this means that:
 
<math>w = x ** h</math>
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 effectaffect the output.]]
 
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 &and Applicationsapplications===
 
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 electroopticalelectro-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.<ref>{{Cite web|title = MARBLE: Interactive Vision|url = http://homepages.inf.ed.ac.uk/rbf/CVonline/LOCAL_COPIES/MARBLE/|website = homepages.inf.ed.ac.uk|accessdateaccess-date = 2015-11-12}}</ref>
 
[[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|accessdateaccess-date = 2015-11-12}}</ref>
 
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-Columncolumn Decompositiondecomposition with Separableseparable Signalssignals==
 
===Separable Signalssignals===
 
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 delta-dirac-delta impulse function.
 
<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> (delta-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.
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(k_1k_2)x(n_1n_2-k_1k_2)\bigg)</math>
 
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(n_2n_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>n_M</math> one-dimensional convolutions.
 
===Row-Columncolumn Decompositiondecomposition===
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 journalbook|last1=Sihvo|first1=Tero|title=International Symposium on Signals, Circuits and Systems, 2005. ISSCS 2005|volume=1|pages=99–102|last2=Niittylahti|first2=Jarkko|titlechapter=Row-Column Decomposition Based 2D Transform Optimization on Subword Parallel Processors|date=5 June 2005|accessdatedoi=8 November 201510.1109/ISSCS.2005.1509860|isbn=978-0-7803-9029-4}}</ref> The following shows the mathematical reasoning behind the row-column decomposition approach (typically <math>h(n_1,n_2)</math> is the separable signal):
 
<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}
<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>\\
 
<math>y(n_1,n_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)</math>\\
 
<math>y(n_1,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_1n_2k_1,n_2-k_2)\Bigg]</math>
\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|accessdateaccess-date=10 November 2015}}</ref> In order to take advantage of the way in which memory is accessed, it is more efficient to transpose the data set and then axisaccess it row-wise rather than attempt to access it column-wise. The algorithm then becomes:
# 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 Speedupspeedup from Rowrow-Columncolumn Decompositiondecomposition===
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|accessdateaccess-date=10 November 2015}}</ref> A comparison of the computational complexity between direct and separable convolution is given in the following image:
 
[[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 Convolutionconvolution of Discretediscrete-Valuedvalued Multidimensionalmultidimensional Signalssignals==
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 Theoremtheorem in Multiplemultiple Dimensionsdimensions===
 
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>
 
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 Convolutionconvolution Approachapproach===
 
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 Aliasingaliasing===
 
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 Procedureprocedure Usingusing 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:<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>
# MultipleMultiply the results of the DFTs to obtain <math>Y(k_1,k_2)=H(k_1,k_2)X(k_1,k_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 Addadd==
 
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 journalbook|last1 = Fernandez|first1 = Joseph|last2 = Kumar|first2 = Vijaya|title = Multidimensional Overlap-Add and Overlap-Save for Correlation and Convolution|journalpages = IEEE509–513|datedoi = 10.1109/ICIP.2013.6738105|issueyear = Image Processing (ICIP)2013|pagesisbn = 509–513978-1-4799-2341-0}}</ref> 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:
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 = |accessdate = November 11, 2015|website = EE502: Digital Signal Processing|publisher = Dublin City University|last = |first = |page = 24}}</ref> 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 Smallersmaller Convolutionconvolution Blocksblocks===
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 Procedureprocedure===
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 = |accessdate = November 12, 2015|website = |publisher = University of Toronto|last = Kundur|first = Deepa}}</ref>
 
===Pictorial Methodmethod of Operationoperation===
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 = |accessdate = November 11, 2015|website = EE502: Digital Signal Processing|publisher = Dublin City University|last = |first = |page = 26}}</ref>
 
==Overlap and Savesave==
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 Overlapoverlap and Addadd===
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|url = |title = High-Speed Multidimensional Convolution|last = Kim|first = Chang|date = May 1980|journal = IEEE Transactions on Pattern Analysis and Machine Intelligence|doi = 10.1109/tpami.1980.4767017 |pmidlast2 = Strintzis|access-datefirst2 = Michael|last2volume=PAMI-2|issue = Strintzis3|first2 pages= Michael269–273}}</ref> 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 Procedureprocedure===
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 Helixhelix Transformtransform==
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 Convolutionconvolution with Oneone-Dimensionaldimensional Convolutionconvolution Methodsmethods===
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_{MxNM \times N}</math> and <math>Y_{K x\times L}</math>, which results in an output <math>Z_{(MxNM - K + 1)+\times(KxLN - L + 1)}</math>. This is expressed as follows:
 
<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>
 
Interestingly, thisThis vector length is equivalent to the dimensions of the original matrix output <math>Z</math>, making converting back to a matrix a direct transformation. Thus, the vector, <math>Z''</math>, is converted back to matrix form, which produces the output of the two-dimensional discrete convolution.<ref name=":1">{{Cite journal|url = https://www.researchgate.net/publication/274360447|title = Multidimensional convolution via a 1D convolution algorithm|last = Naghizadeh|first = Mostafa|date = November 2009|journal = The Leading Edge|doi = |pmid = |access-date = |last2 = Sacchi|first2 = Mauricio}}</ref>
 
===Filtering on a Helixhelix===
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|url = |title = Multidimensional recursive filters via a helix|last = Claerbout|first = Jon|date = September 1998|journal = Geophysics|doivolume = 63|pmidissue = 5|access-datedoi = 10.1190/1.1444449|page = 9|citeseerx = 10.1.1.76.1193|bibcode = 1998Geop...63.1532C}}</ref>
 
===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|url = |title = Exploring three-dimensional implicit wavefield extrapolation with the helix transform|last = Fomel|first = Sergey|date = 1997|journal = SEP reportReport|doilast2 = Claerbout|pmidfirst2 = Jon|access-datepages = 43–60|last2url = Claerbouthttps://pdfs.semanticscholar.org/5993/a76fdb37d3b1a3dfba795d6ed596c608cec9.pdf|first2archive-url = Jonhttps://web.archive.org/web/20190104124207/https://pdfs.semanticscholar.org/5993/a76fdb37d3b1a3dfba795d6ed596c608cec9.pdf|pagesurl-status = 43–60dead|archive-date = 2019-01-04}}</ref> Other applications include helpful algorithms in seismic data regularization, prediction error filters, and noise attenuation in geophysical digital systems.<ref name=":1" />
 
==Gaussian Convolutionconvolution==
 
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.
[[File:Wiki gauss.png|thumb|300px|2D Gaussian Visualization where <math>\mu_1=\mu_2=0</math> and <math>\sigma_1=\sigma_2=1</math>]]
 
The Gaussian distribution sampled at discrete values in one dimension is given by the following (assuming <math>\mu=0</math>):<math display="block">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>\sigma</math> stays constant for all dimensions and <math>\mu_1=\mu_2=...=\mu_M=0</math>):<math display="block">G(n_1,n_2,...,n_M)=\frac{1}{(2\pi\sigma)^{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 display="block">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>y(n)=x(n)*G(n)</math>
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 Filterfilter===
 
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 Onon Line|date=2013|pages=286–310|urldoi=http://dx.doi.org/10.5201/ipol.2013.87|accessdatevolume=12 November 20153|doi-access=free}}</ref>
 
<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 Boxbox Filterfilter===
 
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|url = http://dx.doi.org/10.1109/TPAMI.1986.4767776|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|pmid volume= |accessPAMI-date8|issue = 2|pages=234–239}}</ref>
 
<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|accessdateaccess-date = 2015-11-12}}</ref> It is also commonly used in [[Computer vision]] applications such as [[Scale-invariant feature transform]] (SIFT) feature detection.<ref>{{cite journal|last1=Lowe|first1=D.G.|title=Object recognition from local scale-invariant features|journal=Proceedings of the International Conference on Computer Vision|date=1999|volume=2|pages=1150–1157|accessdateurl=12 November 2015http://www.cs.ubc.ca/~lowe/papers/iccv99.pdf}}</ref>
 
==See also==
* [[Convolution]]
* [[ImageKernel (image processing)]]
* [[Signal processing]]