Company Events Academic NI Developer Zone Support Solutions Products & Services Contact NI MyNI

Convolution (Not in Base Package)

LabVIEW 8.5 Help
August 2007

NI Part Number:
371361D-01

»View Product Info

Computes the convolution of the input sequences X and Y. The data type you wire to the X input determines the polymorphic instance to use.

Details  Example

Use the pull-down menu to select an instance of this VI.

1D Convolution (DBL)

X is the first input sequence.
Y is the second input sequence.
algorithm specifies the convolution method to use. When algorithm is direct, this VI computes the convolution using the direct method of linear convolution. When algorithm is frequency domain, this VI computes the convolution using an FFT-based technique. If X and Y are small, the direct method typically is faster. If X and Y are large, the frequency domain method typically is faster. Additionally, slight numerical differences can exist between the two methods.

0direct
1frequency domain (default)
X * Y is the convolution of X and Y.
error returns any error or warning from the VI. You can wire error to the Error Cluster From Error Code VI to convert the error code or warning into an error cluster.

1D Convolution (CDB)

X is the first complex valued input sequence.
Y is the second complex valued input sequence.
algorithm specifies the convolution method to use. When algorithm is direct, this VI computes the convolution using the direct method of linear convolution. When algorithm is frequency domain, this VI computes the convolution using an FFT-based technique. If X and Y are small, the direct method typically is faster. If X and Y are large, the frequency domain method typically is faster. Additionally, slight numerical differences can exist between the two methods.

0direct
1frequency domain (default)
X * Y is the convolution of X and Y.
error returns any error or warning from the VI. You can wire error to the Error Cluster From Error Code VI to convert the error code or warning into an error cluster.

2D Convolution (DBL)

X is the first input sequence.
Y is the second input sequence.
algorithm specifies the convolution method to use. When algorithm is direct, this VI computes the convolution using the direct method of linear convolution. When algorithm is frequency domain, this VI computes the convolution using an FFT-based technique. If X and Y are small, the direct method typically is faster. If X and Y are large, the frequency domain method typically is faster. Additionally, slight numerical differences can exist between the two methods.

0direct
1frequency domain (default)
output size determines the size of X * Y.

0full (default)—Sets the width of X * Y to one less than the sum of the widths of X and Y and sets the height of X * Y to one less than the sum of the heights of X and Y.
1size X—Sets the width and height of X * Y to the width and height of X.
2compact—Sets the width of X * Y to one more than the difference of the widths of X and Y and sets the height of X * Y to one more than the difference of the heights of X and Y. The width and height of X must be greater than or equal to the width and height of Y, respectively, when output size is compact.
X * Y is the convolution of X and Y.
error returns any error or warning from the VI. You can wire error to the Error Cluster From Error Code VI to convert the error code or warning into an error cluster.

2D Convolution (CDB)

X is the first complex valued input sequence.
Y is the second complex valued input sequence.
algorithm specifies the convolution method to use. When algorithm is direct, this VI computes the convolution using the direct method of linear convolution. When algorithm is frequency domain, this VI computes the convolution using an FFT-based technique. If X and Y are small, the direct method typically is faster. If X and Y are large, the frequency domain method typically is faster. Additionally, slight numerical differences can exist between the two methods.

0direct
1frequency domain (default)
output size determines the size of X * Y.

0full (default)—Sets the width of X * Y to one less than the sum of the widths of X and Y and sets the height of X * Y to one less than the sum of the heights of X and Y.
1size X—Sets the width and height of X * Y to the width and height of X.
2compact—Sets the width of X * Y to one more than the difference of the widths of X and Y and sets the height of X * Y to one more than the difference of the heights of X and Y. The width and height of X must be greater than or equal to the width and height of Y, respectively, when output size is compact.
X * Y is the convolution of X and Y.
error returns any error or warning from the VI. You can wire error to the Error Cluster From Error Code VI to convert the error code or warning into an error cluster.

Convolution Details

1D Convolution

The convolution of the signals x(t) and y(t) is defined as:

where the symbol * denotes convolution.

This VI uses the following equation to perform the discrete implementation of the convolution and obtain the elements of X * Y.

for i = 0, 1, 2, … , M+N–2

where h is X * Y

N is the number of elements in X,

M is the number of elements in Y,

the indexed elements outside the ranges of X and Y are equal to zero, as shown in the following relationships:

xj = 0, j < 0, or j N

and

yj = 0, j < 0, or j M.

The convolution operation performed by this VI is not a circular convolution. Because x(t) * y(t) X(f)Y(f) is a Fourier transform pair, you can create a circular version of the convolution using a block diagram similar to the block diagram shown in the following illustration.

2D Convolution

The Convolution VI computes two-dimensional convolution of the input matrices X and Y as follows:

for i = 0, 1, 2, … , M1+M2–2 and j = 0, 1, 2, … , N1+N2–2

where h is X * Y,

M1 is the number of rows of matrix X,

N1 is the number of columns of matrix X,

M2 is the number of rows of matrix Y,

N2 is the number of columns of matrix Y,

The indexed elements outside the ranges of X and Y are equal to zero, as shown in the following relationships:

x(m,n), m < 0 or m M1 or n < 0 or n N1

and

y(m,n) , m < 0 or m M2 or n < 0 or n N2.

The output size determines the size of the output matrix X * Y as shown in the following figure.

  1. full

    The output matrix X * Y is (M1+M2–1)-by-(N1+N2–1).
  2. size X

    This is useful in image processing. If X is the image you want to filter, Y is a small matrix called the convolution kernel. X * Y is the filtered image whose size is the same as that of image X. The output M1-by-N1 matrix is the central part of the output matrix when the output size is full.
  3. compact

    Computing the edge elements of X * Y requires zero-padding if the output size is full or size X. LabVIEW removes these edge elements if the output size is compact. The output (M1M2+1)-by-(N1N2+1) matrix is the central part of the output matrix when the output size is size X.

Example

Refer to the Edge Detection with 2D Convolution VI in the labview\examples\analysis\dspxmpl.llb for an example of using the Convolution VI.


Resources


 

Your Feedback! poor Poor  |  Excellent excellent   Yes No
 Document Quality? 
 Answered Your Question? 
Add Comments 1 2 3 4 5 submit