Top Banner
Computer Vision System Toolbox™ Reference R2014a
1889

Computer Vision System Toolbox™ Reference

Jan 23, 2016

Download

Documents

Khai Huynh

Computer Vision System Toolbox™ Reference
Welcome message from author
This document is posted to help you gain knowledge. Please leave a comment to let me know what you think about it! Share it to your friends and learn new things together.
Transcript
  • Computer Vision System Toolbox

    Reference

    R2014a

  • How to Contact MathWorks

    www.mathworks.com Webcomp.soft-sys.matlab Newsgroupwww.mathworks.com/contact_TS.html Technical [email protected] Product enhancement [email protected] Bug [email protected] Documentation error [email protected] Order status, license renewals, [email protected] Sales, pricing, and general information

    508-647-7000 (Phone)

    508-647-7001 (Fax)

    The MathWorks, Inc.3 Apple Hill DriveNatick, MA 01760-2098For contact information about worldwide offices, see the MathWorks Web site.Computer Vision System Toolbox Reference COPYRIGHT 20002014 by The MathWorks, Inc.The software described in this document is furnished under a license agreement. The software may be usedor copied only under the terms of the license agreement. No part of this manual may be photocopied orreproduced in any form without prior written consent from The MathWorks, Inc.FEDERAL ACQUISITION: This provision applies to all acquisitions of the Program and Documentationby, for, or through the federal government of the United States. By accepting delivery of the Programor Documentation, the government hereby agrees that this software or documentation qualifies ascommercial computer software or commercial computer software documentation as such terms are usedor defined in FAR 12.212, DFARS Part 227.72, and DFARS 252.227-7014. Accordingly, the terms andconditions of this Agreement and only those rights specified in this Agreement, shall pertain to and governthe use, modification, reproduction, release, performance, display, and disclosure of the Program andDocumentation by the federal government (or other entity acquiring for or through the federal government)and shall supersede any conflicting contractual terms or conditions. If this License fails to meet thegovernments needs or is inconsistent in any respect with federal procurement law, the government agreesto return the Program and Documentation, unused, to The MathWorks, Inc.

    Trademarks

    MATLAB and Simulink are registered trademarks of The MathWorks, Inc. Seewww.mathworks.com/trademarks for a list of additional trademarks. Other product or brandnames may be trademarks or registered trademarks of their respective holders.Patents

    MathWorks products are protected by one or more U.S. patents. Please seewww.mathworks.com/patents for more information.

  • Revision HistoryApril 2011 Online only Revised for Version 4.0 (Release 2011a)September 2011 Online only Revised for Version 4.1 (Release 2011b)March 2012 Online only Revised for Version 5.0 (Release 2012a)September 2012 Online only Revised for Version 5.1 (Release R2012b)March 2013 Online only Revised for Version 5.2 (Release R2013a)September 2013 Online only Revised for Version 5.3 (Release R2013b)March 2014 Online only Revised for Version 6.0 (Release R2014a)

  • Contents

    Blocks Alphabetical List

    1

    Alphabetical List

    2

    Functions Alphabetical

    3

    v

  • vi Contents

  • 1Blocks Alphabetical List

  • 2-D Autocorrelation

    Purpose Compute 2-D autocorrelation of input matrix

    Library Statisticsvisionstatistics

    Description The 2-D Autocorrelation block computes the two-dimensionalautocorrelation of the input matrix. Assume that input matrix A hasdimensions (Ma, Na). The equation for the two-dimensional discreteautocorrelation is

    C i j A m n conj A m i n jn

    Na

    m

    Ma( , ) ( , ) ( ( , ))

    ( )( )= + +

    =

    =

    0

    1

    0

    1

    where 0 2 1 < i Ma and 0 2 1 < j Na .

    The output of this block has dimensions ( , )2 1 2 1Ma Na .

    Port Input/Output Supported Data TypesComplexValuesSupported

    Input Vector or matrix ofintensity values or ascalar, vector, or matrixthat represents one planeof the RGB video stream

    Double-precision floating point Single-precision floating point Fixed point 8-, 16-, 32-bit signed integer 8-, 16-, 32-bit unsigned integer

    Yes

    Output Autocorrelation of theinput matrix

    Same as Input port Yes

    If the data type of the input is floating point, the output of the block hasthe same data type.

    1-2

  • 2-D Autocorrelation

    Fixed-Point Data Types

    The following diagram shows the data types used in the 2-DAutocorrelation block for fixed-point signals.

    You can set the product output, accumulator, and output data types inthe block mask as discussed in Dialog Box on page 1-4.The output of the multiplier is in the product output data type if atleast one of the inputs to the multiplier is real. If both of the inputsto the multiplier are complex, the result of the multiplication is inthe accumulator data type. For details on the complex multiplicationperformed, refer to Multiplication Data Types.

    1-3

  • 2-D Autocorrelation

    DialogBox

    TheMain pane of the 2-D Autocorrelation dialog box appears as shownin the following figure.

    The Data Types pane of the 2-D Autocorrelation dialog box appearsas shown in the following figure.

    1-4

  • 2-D Autocorrelation

    Rounding modeSelect the Rounding Modes for fixed-point operations.

    Overflow modeSelect the Overflow mode for fixed-point operations.

    1-5

  • 2-D Autocorrelation

    Product outputSpecify the product output data type. See Fixed-Point DataTypes on page 1-3 and Multiplication Data Types forillustrations depicting the use of the product output data typein this block: When you select Same as input, these characteristics matchthose of the input to the block.

    When you select Binary point scaling, you can enter theword length and the fraction length of the product output, inbits.

    When you select Slope and bias scaling, you can enter theword length, in bits, and the slope of the product output. Thebias of all signals in the Computer Vision System Toolboxsoftware is 0.

    AccumulatorUse this parameter to specify how to designate the accumulatorword and fraction lengths. Refer to Fixed-Point Data Typeson page 1-3 and Multiplication Data Types for illustrationsdepicting the use of the accumulator data type in this block.The accumulator data type is only used when both inputs to themultiplier are complex. When you select Same as product output, thesecharacteristics match those of the product output.

    When you select Same as input, these characteristics matchthose of the input to the block.

    When you select Binary point scaling, you can enter theword length and the fraction length of the accumulator, in bits.

    When you select Slope and bias scaling, you can enter theword length, in bits, and the slope of the accumulator. The biasof all signals in the Computer Vision System Toolbox softwareis 0.

    1-6

  • 2-D Autocorrelation

    OutputChoose how to specify the output word length and fraction length. When you select Same as input, these characteristics matchthose of the input to the block.

    When you select Binary point scaling, you can enter theword length and the fraction length of the output, in bits.

    When you select Slope and bias scaling, you can enter theword length, in bits, and the slope of the output. The bias of allsignals in the Computer Vision System Toolbox software is 0.

    Lock data type settings against change by the fixed-point toolsSelect this parameter to prevent the fixed-point tools fromoverriding the data types you specify on the block mask. For moreinformation, see fxptdlg, a reference page on the Fixed-PointTool in the Simulink documentation.

    See Also 2-D Correlation Computer Vision System Toolbox2-D Histogram Computer Vision System Toolbox2-D Mean Computer Vision System Toolbox2-D Median Computer Vision System Toolbox2-D Standard Deviation Computer Vision System Toolbox2-D Variance Computer Vision System Toolbox2-D Maximum Computer Vision System Toolbox2-D Minimum Computer Vision System Toolbox

    1-7

  • 2-D Convolution

    Purpose Compute 2-D discrete convolution of two input matrices

    Library Filteringvisionfilter

    Description

    The 2-D Convolution block computes the two-dimensional convolutionof two input matrices. Assume that matrix A has dimensions (Ma, Na)and matrix B has dimensions (Mb, Nb). When the block calculates thefull output size, the equation for the 2-D discrete convolution is

    C i j A m n B i m j nn

    Na

    m

    Ma( , ) ( , ) * ( , )

    ( )( )=

    =

    =

    0

    1

    0

    1

    where 0 1 < + i Ma Mb and 0 1 < + j Na Nb .

    Port Input/Output Supported Data TypesComplexValuesSupported

    I1 Matrix of intensityvalues or a matrix thatrepresents one plane ofthe RGB video stream

    Double-precision floating point Single-precision floating point Fixed point 8-, 16-, 32-bit signed integer 8-, 16-, 32-bit unsigned integer

    Yes

    I2 Matrix of intensityvalues or a matrix that

    Same as I1 port Yes

    1-8

  • 2-D Convolution

    Port Input/Output Supported Data TypesComplexValuesSupported

    represents one plane ofthe RGB video stream

    Output Convolution of the inputmatrices

    Same as I1 port Yes

    If the data type of the input is floating point, the output of the block hasthe same data type.The dimensions of the output are dictated by the Output sizeparameter. Assume that the input at port I1 has dimensions (Ma, Na)and the input at port I2 has dimensions (Mb, Nb). If, for the Outputsize parameter, you choose Full, the output is the full two-dimensionalconvolution with dimensions (Ma+Mb-1, Na+Nb-1). If, for the Outputsize parameter, you choose Same as input port I1, the output is thecentral part of the convolution with the same dimensions as the input atport I1. If, for the Output size parameter, you choose Valid, the outputis only those parts of the convolution that are computed without thezero-padded edges of any input. This output has dimensions (Ma-Mb+1,Na-Nb+1). However, if all(size(I1)

  • 2-D Convolution

    You can set the product output, accumulator, and output data types inthe block mask as discussed in Dialog Box on page 1-15.The output of the multiplier is in the product output data type if atleast one of the inputs to the multiplier is real. If both of the inputsto the multiplier are complex, the result of the multiplication is inthe accumulator data type. For details on the complex multiplicationperformed, refer to Multiplication Data Types.

    Examples Example 1Suppose I1, the first input matrix, has dimensions (4,3) and I2, thesecond input matrix, has dimensions (2,2). If, for the Output sizeparameter, you choose Full, the block uses the following equations todetermine the number of rows and columns of the output matrix:

    The resulting matrix is

    1-10

  • 2-D Convolution

    If, for the Output size parameter, you choose Same as input portI1, the output is the central part of Cfull with the same dimensions asthe input at port I1, (4,3). However, since a 4-by-3 matrix cannot beextracted from the exact center of Cfull , the block leaves more rows andcolumns on the top and left side of the Cfull matrix and outputs:

    If, for the Output size parameter, you choose Valid, the block uses thefollowing equations to determine the number of rows and columns ofthe output matrix:

    1-11

  • 2-D Convolution

    In this case, it is always possible to extract the exact center of Cfull .Therefore, the block outputs

    Example 2

    In convolution, the value of an output element is computed as aweighted sum of neighboring elements.For example, suppose the first input matrix represents an image andis defined as

    I1 = [17 24 1 8 1523 5 7 14 164 6 13 20 22

    10 12 19 21 311 18 25 2 9]

    The second input matrix also represents an image and is defined as

    I2 = [8 1 63 5 74 9 2]

    The following figure shows how to compute the (1,1) output element(zero-based indexing) using these steps:

    1-12

  • 2-D Convolution

    1 Rotate the second input matrix, I2, 180 degrees about its centerelement.

    2 Slide the center element of I2 so that it lies on top of the (0,0) elementof I1.

    3 Multiply each element of the rotated I2 matrix by the element ofI1 underneath.

    4 Sum the individual products from step 3.

    Hence the (1,1) output element is0 2 0 9 0 4 0 7 17 5 24 3 0 6 23 1 5 8 220 + + + + + + + + = .

    1-13

  • 2-D Convolution

    !

    !

    Computing the (1,1) Output of Convolution

    The normalized convolution of the (1,1) output element is220/sqrt(sum(dot(I1p,I1p))*sum(dot(I2,I2))) = 0.3459, whereI1p = [0 0 0; 0 17 24; 0 23 5].

    1-14

  • 2-D Convolution

    DialogBox

    The Main pane of the 2-D Convolution dialog box appears as shown inthe following figure.

    1-15

  • 2-D Convolution

    Output sizeThis parameter controls the size of the output scalar, vector, ormatrix produced as a result of the convolution between the twoinputs. If you choose Full, the output has dimensions (Ma+Mb-1,Na+Nb-1). If you choose Same as input port I1, the output hasthe same dimensions as the input at port I1. If you choose Valid,output has dimensions (Ma-Mb+1, Na-Nb+1).

    Output normalized convolutionIf you select this check box, the blocks output is normalized.

    The Data Types pane of the 2-D Convolution dialog box appears asshown in the following figure.

    1-16

  • 2-D Convolution

    Rounding modeSelect the rounding mode for fixed-point operations.

    Overflow modeSelect the Overflow mode for fixed-point operations.

    1-17

  • 2-D Convolution

    Product outputUse this parameter to specify how to designate the product outputword and fraction lengths. Refer to Fixed-Point Data Typeson page 1-9 and Multiplication Data Types for illustrationsdepicting the use of the product output data type in this block: When you select Same as first input, these characteristicsmatch those of the first input to the block.

    When you select Binary point scaling, you can enter theword length and the fraction length of the product output, inbits.

    When you select Slope and bias scaling, you can enterthe word length, in bits, and the slope of the product output.The bias of all signals in theComputer Vision System Toolboxsoftware is 0.

    The Product Output inherits its sign according to the inputs. Ifeither or both input I1 and I2 are signed, the Product Outputwill be signed. Otherwise, the Product Output is unsigned. Thefollowing table shows all cases.

    Sign of Input I1 Sign of Input I2 Sign of ProductOutput

    unsigned unsigned unsignedunsigned signed signedsigned unsigned signedsigned signed signed

    AccumulatorUse this parameter to specify how to designate the accumulatorword and fraction lengths. Refer to Fixed-Point Data Typeson page 1-9 and Multiplication Data Types for illustrationsdepicting the use of the accumulator data type in this block.The accumulator data type is only used when both inputs to themultiplier are complex:

    1-18

  • 2-D Convolution

    When you select Same as product output, thesecharacteristics match those of the product output.

    When you select Same as first input, these characteristicsmatch those of the first input to the block.

    When you select Binary point scaling, you can enter theword length and the fraction length of the accumulator, in bits.

    When you select Slope and bias scaling, you can enter theword length, in bits, and the slope of the accumulator. The biasof all signals in the Computer Vision System Toolbox softwareis 0.

    OutputChoose how to specify the word length and fraction length of theoutput of the block: When you select Same as first input, these characteristicsmatch those of the first input to the block.

    When you select Binary point scaling, you can enter theword length and the fraction length of the output, in bits.

    When you select Slope and bias scaling, you can enter theword length, in bits, and the slope of the output. The bias of allsignals in the Computer Vision System Toolbox software is 0.

    Lock data type settings against change by the fixed-point toolsSelect this parameter to prevent the fixed-point tools fromoverriding the data types you specify on the block mask. For moreinformation, see fxptdlg, a reference page on the Fixed-PointTool in the Simulink documentation.

    See Also 2-D FIR Filter Computer Vision System Toolboxsoftware

    1-19

  • 2-D Correlation

    Purpose Compute 2-D cross-correlation of two input matrices

    Library Statisticsvisionstatistics

    1-20

  • 2-D Correlation

    Description

    The 2-D Correlation block computes the two-dimensionalcross-correlation of two input matrices Assume that matrix A

    1-21

  • 2-D Correlation

    C i j A m n conj B m i n jn

    Na

    m

    Ma( , ) ( , ) ( ( , ))

    ( )( )= + +

    =

    =

    0

    1

    0

    1

    where 0 1 < + i Ma Mb and 0 1 < + j Na Nb .

    Port Input/Output Supported Data TypesComplexValuesSupported

    I1 Vector or matrix ofintensity values

    Double-precision floating point Single-precision floating point Fixed point 8-, 16-, 32-bit signed integer 8-, 16-, 32-bit unsigned integer

    Yes

    I2 Scalar, vector, or matrixof intensity values or ascalar, vector, or matrixthat represents one planeof the RGB video stream

    Same as I1 port Yes

    Output Convolution of the inputmatrices

    Same as I1 port Yes

    If the data type of the input is floating point, the output of the block isthe same data type.The dimensions of the output are dictated by the Output sizeparameter and the sizes of the inputs at ports I1 and I2. For example,assume that the input at port I1 has dimensions (Ma, Na) and the inputat port I2 has dimensions (Mb, Nb). If, for the Output size parameter,you choose Full, the output is the full two-dimensional cross-correlationwith dimensions (Ma+Mb-1, Na+Nb-1). If, for the Output sizeparameter, you choose Same as input port I1, the output is thecentral part of the cross-correlation with the same dimensions as theinput at port I1. If, for the Output size parameter, you choose Valid,

    1-22

  • 2-D Correlation

    the output is only those parts of the cross-correlation that are computedwithout the zero-padded edges of any input. This output has dimensions(Ma-Mb+1, Na-Nb+1). However, if all(size(I1)

  • 2-D Correlation

    Examples Example 1Suppose I1, the first input matrix, has dimensions (4,3). I2, the secondinput matrix, has dimensions (2,2). If, for the Output size parameter,you choose Full, the block uses the following equations to determinethe number of rows and columns of the output matrix:

    The resulting matrix is

    If, for the Output size parameter, you choose Same as input portI1, the output is the central part of Cfull with the same dimensions asthe input at port I1, (4,3). However, since a 4-by-3 matrix cannot beextracted from the exact center of Cfull , the block leaves more rows andcolumns on the top and left side of the Cfull matrix and outputs:

    1-24

  • 2-D Correlation

    If, for the Output size parameter, you choose Valid, the block uses thefollowing equations to determine the number of rows and columns ofthe output matrix:

    In this case, it is always possible to extract the exact center of Cfull .Therefore, the block outputs

    1-25

  • 2-D Correlation

    Example 2

    In cross-correlation, the value of an output element is computed as aweighted sum of neighboring elements.For example, suppose the first input matrix represents an image andis defined as

    I1 = [17 24 1 8 1523 5 7 14 164 6 13 20 22

    10 12 19 21 311 18 25 2 9]

    The second input matrix also represents an image and is defined as

    I2 = [8 1 63 5 74 9 2]

    The following figure shows how to compute the (2,4) output element(zero-based indexing) using these steps:

    1 Slide the center element of I2 so that lies on top of the (1,3) elementof I1.

    2 Multiply each weight in I2 by the element of I1 underneath.

    3 Sum the individual products from step 2.

    The (2,4) output element from the cross-correlation is1 8 8 1 15 6 7 3 14 5 16 7 13 4 20 9 22 2 585 + + + + + + + + = .

    1-26

  • 2-D Correlation

    !

    !

    Computing the (2,4) Output of Cross-Correlation

    1-27

  • 2-D Correlation

    The normalized cross-correlation of the (2,4) output element is585/sqrt(sum(dot(I1p,I1p))*sum(dot(I2,I2))) = 0.8070, whereI1p = [1 8 15; 7 14 16; 13 20 22].

    1-28

  • 2-D Correlation

    DialogBox

    The Main pane of the 2-D Correlation dialog box appears as shown inthe following figure.

    1-29

  • 2-D Correlation

    Output sizeThis parameter controls the size of the output scalar, vector, ormatrix produced as a result of the cross-correlation betweenthe two inputs. If you choose Full, the output has dimensions(Ma+Mb-1, Na+Nb-1). If you choose Same as input port I1, theoutput has the same dimensions as the input at port I1. If youchoose Valid, output has dimensions (Ma-Mb+1, Na-Nb+1).

    Normalized outputIf you select this check box, the blocks output is normalized.

    The Data Types pane of the 2-D Correlation dialog box appears asshown in the following figure.

    1-30

  • 2-D Correlation

    Rounding modeSelect the Rounding Modes for fixed-point operations.

    1-31

  • 2-D Correlation

    Overflow modeSelect the Overflow mode for fixed-point operations.

    Product outputSpecify the product output data type. See Fixed-Point DataTypes on page 1-23 and Multiplication Data Types forillustrations depicting the use of the product output data typein this block: When you select Same as first input, these characteristicsmatch those of the first input to the block.

    When you select Binary point scaling, you can enter theword length and the fraction length of the product output, inbits.

    When you select Slope and bias scaling, you can enter theword length, in bits, and the slope of the product output. Thebias of all signals in the Computer Vision System Toolboxsoftware is 0.

    The Product Output inherits its sign according to the inputs. Ifeither or both input I1 and I2 are signed, the Product Outputwill be signed. Otherwise, the Product Output is unsigned. Thetable below show all cases.

    Sign of Input I1 Sign of Input I2 Sign of ProductOutput

    unsigned unsigned unsignedunsigned signed signedsigned unsigned signedsigned signed signed

    AccumulatorUse this parameter to specify how to designate the accumulatorword and fraction lengths. Refer to Fixed-Point Data Typeson page 1-23 andMultiplication Data Types for illustrations

    1-32

  • 2-D Correlation

    depicting the use of the accumulator data type in this block.The accumulator data type is only used when both inputs to themultiplier are complex: When you select Same as product output, thesecharacteristics match those of the product output.

    When you select Same as first input, these characteristicsmatch those of the first input to the block.

    When you select Binary point scaling, you can enter theword length and the fraction length of the accumulator, in bits.

    When you select Slope and bias scaling, you can enter theword length, in bits, and the slope of the accumulator. The biasof all signals in the Computer Vision System Toolbox softwareis 0.

    OutputChoose how to specify the word length and fraction length of theoutput of the block: When you select Same as first input, these characteristicsmatch those of the first input to the block.

    When you select Binary point scaling, you can enter theword length and the fraction length of the output, in bits.

    When you select Slope and bias scaling, you can enter theword length, in bits, and the slope of the output. The bias of allsignals in the Computer Vision System Toolbox software is 0.

    Lock data type settings against change by the fixed-point toolsSelect this parameter to prevent the fixed-point tools fromoverriding the data types you specify on the block mask. For moreinformation, see fxptdlg, a reference page on the Fixed-PointTool in the Simulink documentation.

    1-33

  • 2-D Correlation

    See Also 2-D Autocorrelation Computer Vision System Toolbox2-D Histogram Computer Vision System Toolbox2-D Mean Computer Vision System Toolbox2-D Median Computer Vision System Toolbox2-D Standard Deviation Computer Vision System Toolbox2-D Variance Computer Vision System Toolbox2-D Maximum Computer Vision System Toolbox2-D Minimum Computer Vision System Toolbox

    1-34

  • 2-D DCT

    Purpose Compute 2-D discrete cosine transform (DCT)

    Library Transformsvisiontransforms

    Description The 2-D DCT block calculates the two-dimensional discrete cosinetransform of the input signal. The equation for the two-dimensionalDCT is

    F m nMN

    C m C n f x yx m

    My

    y

    N

    x

    M( , ) ( ) ( ) ( , ) cos

    ( )cos

    (=

    + +

    =

    =

    2 2 122

    0

    1

    0

    1 112

    )nN

    where C m C n( ), ( ) /= 1 2 for m n, = 0 and C m C n( ), ( ) = 1 otherwise.The number of rows and columns of the input signal must be powersof two. The output of this block has dimensions the same dimensionsas the input.

    Port Input/Output Supported Data TypesComplexValuesSupported

    Input Vector or matrix ofintensity values

    Double-precision floating point Single-precision floating point Fixed point 8-, 16-, 32-bit signed integer 8-, 16-, 32-bit unsigned integer

    No

    Output 2-D DCT of the input Same as Input port No

    If the data type of the input signal is floating point, the output of theblock is the same data type.

    1-35

  • 2-D DCT

    Use the Sine and cosine computation parameter to specify how theblock computes the sine and cosine terms in the DCT algorithm. Ifyou select Trigonometric fcn, the block computes the sine and cosinevalues during the simulation. If you select Table lookup, the blockcomputes and stores the trigonometric values before the simulationstarts. In this case, the block requires extra memory.

    Fixed-Point Data Types

    The following diagram shows the data types used in the 2-D DCT blockfor fixed-point signals. Inputs are first cast to the output data type andstored in the output buffer. Each butterfly stage processes signals inthe accumulator data type, with the final output of the butterfly beingcast back into the output data type.

    1-36

  • 2-D DCT

    1-37

  • 2-D DCT

    The output of the multiplier is in the product output data type whenat least one of the inputs to the multiplier is real. When both inputsto the multiplier are complex, the result of the multiplication is inthe accumulator data type. For details on the complex multiplicationperformed, refer to Multiplication Data Types. You can set the sinetable, product output, accumulator, and output data types in the blockmask as discussed in the next section.

    DialogBox

    The Main pane of the 2-D DCT dialog box appears as shown in thefollowing figure.

    Sine and cosine computationSpecify how the block computes the sine and cosine terms in theDCT algorithm. If you select Trigonometric fcn, the blockcomputes the sine and cosine values during the simulation. Ifyou select Table lookup, the block computes and stores the

    1-38

  • 2-D DCT

    trigonometric values before the simulation starts. In this case, theblock requires extra memory.

    The Data Types pane of the 2-D DCT dialog box appears as shown inthe following figure.

    Rounding modeSelect the Rounding Modes for fixed-point operations. The sinetable values do not obey this parameter; they always round toNearest.

    Overflow modeSelect the Overflow mode for fixed-point operations. The sinetable values do not obey this parameter; instead, they are alwayssaturated.

    1-39

  • 2-D DCT

    Sine table data typeChoose how you specify the word length of the values of the sinetable. The fraction length of the sine table values always equalsthe word length minus one. You can set this parameter to: A rule that inherits a data type, for example, Inherit: Same

    word length as input

    An expression that evaluates to a valid data type, for example,fixdt(1,16)

    The sine table values do not obey the Rounding mode andOverflow mode parameters; instead, they are always saturatedand rounded to Nearest.

    Product output data typeSpecify the product output data type. See Fixed-Point DataTypes on page 1-36 and Multiplication Data Types forillustrations depicting the use of the product output data type inthis block. You can set this parameter to: A rule that inherits a data type, for example, Inherit:

    Inherit via internal rule

    An expression that evaluates to a valid data type, for example,fixdt(1,16,0)

    Click the Show data type assistant button todisplay the Data Type Assistant, which helps you set theProduct output data type parameter.

    See Specify Data Types Using Data Type Assistant for moreinformation.

    Accumulator data typeSpecify the accumulator data type. See Fixed-Point Data Typeson page 1-36 for illustrations depicting the use of the accumulatordata type in this block. You can set this parameter to:

    1-40

  • 2-D DCT

    A rule that inherits a data type, for example, Inherit:Inherit via internal rule

    An expression that evaluates to a valid data type, for example,fixdt(1,16,0)

    Click the Show data type assistant button todisplay the Data Type Assistant, which helps you set theAccumulator data type parameter.

    See Specify Data Types Using Data Type Assistant for moreinformation.

    Output data typeSpecify the output data type. See Fixed-Point Data Types onpage 1-36 for illustrations depicting the use of the output datatype in this block. You can set this parameter to: A rule that inherits a data type, for example, Inherit:

    Inherit via internal rule.When you select Inherit: Inherit via internal rule, theblock calculates the output word length and fraction lengthautomatically. The internal rule first calculates an ideal outputword length and fraction length using the following equations:

    WL WL floor DCT lengthideal output input= + +(log ( ))2 1 1

    FL FLideal output input=

    Using these ideal results, the internal rule then selects wordlengths and fraction lengths that are appropriate for yourhardware. For more information, see Inherit via InternalRule.

    An expression that evaluates to a valid data type, for example,fixdt(1,16,0)

    1-41

  • 2-D DCT

    Click the Show data type assistant button todisplay the Data Type Assistant, which helps you set theOutput data type parameter.

    See Specify Data Types Using Data Type Assistant for moreinformation.

    Lock scaling against changes by the autoscaling toolSelect this parameter to prevent any fixed-point scaling youspecify in this block mask from being overridden by theautoscaling tool in the Fixed-Point Tool. For more information,see fxptdlg, a reference page on the Fixed-Point Tool in theSimulink documentation.

    Lock data type settings against change by the fixed-point toolsSelect this parameter to prevent the fixed-point tools fromoverriding the data types you specify on the block mask. For moreinformation, see fxptdlg, a reference page on the Fixed-PointTool in the Simulink documentation.

    References [1] Chen, W.H, C.H. Smith, and S.C. Fralick, A fast computationalalgorithm for the discrete cosine transform, IEEE Trans. Commun.,vol. COM-25, pp. 1004-1009. 1977.

    [2] Wang, Z. Fast algorithms for the discrete W transform and forthe discrete Fourier transform, IEEE Trans. Acoust., Speech, SignalProcessing, vol. ASSP-32, pp. 803-816, Aug. 1984.

    See Also 2-D IDCT Computer Vision System Toolbox software2-D FFT Computer Vision System Toolbox software2-D IFFT Computer Vision System Toolbox software

    1-42

  • 2-D FFT

    Purpose Compute two-dimensional fast Fourier transform of input

    Library Transformsvisiontransforms

    Description The 2-D FFT block computes the fast Fourier transform (FFT). Theblock does the computation of a two-dimensional M-by-N input matrixin two steps. First it computes the one-dimensional FFT along onedimension (row or column). Then it computes the FFT of the output ofthe first step along the other dimension (column or row).The output of the 2-D FFT block is equivalent to the MATLAB fft2function:

    y = fft2(A) % Equivalent MATLAB code

    Computing the FFT of each dimension of the input matrix is equivalentto calculating the two-dimensional discrete Fourier transform (DFT),which is defined by the following equation:

    F m n f x y e ej

    mxM

    y

    N

    x

    M jny

    N( , ) ( , )=

    =

    =

    2

    0

    1

    0

    1 2

    where 0 1 m M and 0 1 n N .

    1-43

  • 2-D FFT

    The output of this block has the same dimensions as the input. Ifthe input signal has a floating-point data type, the data type of theoutput signal uses the same floating-point data type. Otherwise, theoutput can be any fixed-point data type. The block computes scaledand unscaled versions of the FFT.The input to this block can be floating-point or fixed-point, real orcomplex, and conjugate symmetric. The block uses one of two possibleFFT implementations. You can select an implementation based on theFFTW library [1], [2], or an implementation based on a collection ofRadix-2 algorithms. You can select Auto to allow the block to choosethe implementation.

    Port Description

    Port Description Supported Data TypesComplexValuesSupported

    Input Vector or matrix ofintensity values

    Double-precisionfloating point

    Single-precisionfloating point

    Fixed point 8-, 16-, 32-bit signedinteger

    8-, 16-, 32-bit unsignedinteger

    Yes

    Output 2-D FFT of theinput

    Same as Input port Yes

    FFTW Implementation

    The FFTW implementation provides an optimized FFT calculationincluding support for power-of-two and non-power-of-two transform

    1-44

  • 2-D FFT

    lengths in both simulation and code generation. Generated codeusing the FFTW implementation will be restricted to those computerswhich are capable of running MATLAB. The input data type must befloating-point.

    Radix-2 Implementation

    The Radix-2 implementation supports bit-reversed processing, fixed orfloating-point data, and allows the block to provide portable C-codegeneration using the Simulink Coder. The dimensions of the inputmatrix, M and N, must be powers of two. To work with other inputsizes, use the Image Pad block to pad or truncate these dimensions topowers of two, or if possible choose the FFTW implementation.With Radix-2 selected, the block implements one or more of thefollowing algorithms:

    Butterfly operation Double-signal algorithm Half-length algorithm Radix-2 decimation-in-time (DIT) algorithm Radix-2 decimation-in-frequency (DIF) algorithm

    Radix-2 Algorithms for Real or Complex Input ComplexityFloating-Point Signals

    Other Parameter Settings Algorithms Used for IFFT Computation

    Butterfly operation and radix-2 DIT

    Radix-2 DIF

    1-45

  • 2-D FFT

    Other Parameter Settings Algorithms Used for IFFT Computation

    Butterfly operation and radix-2 DIT in conjunctionwith the half-length and double-signal algorithms

    Radix-2 DIF in conjunction with the half-length anddouble-signal algorithms

    Radix-2 Algorithms for Real or Complex Input ComplexityFixed-Point Signals

    Other Parameter Settings Algorithms Used for IFFT Computation

    Butterfly operation and radix-2 DIT

    Radix-2 DIF

    Note The Input is conjugate symmetric parameter cannot be usedfor fixed-point signals.

    Radix-2 Optimization for the Table of Trigonometric ValuesIn certain situations, the blocks Radix2 algorithm computes all thepossible trigonometric values of the twiddle factor

    ej

    kK

    2

    where K is the greater value of either M or N and k K= 0 1, , .The block stores these values in a table and retrieves them duringsimulation. The number of table entries for fixed-point andfloating-point is summarized in the following table:

    1-46

  • 2-D FFT

    Number of Table Entries for N-Point FFT

    floating-point 3 N/4fixed-point N

    Fixed-Point Data TypesThe following diagrams show the data types used in the FFT block forfixed-point signals. You can set the sine table, accumulator, productoutput, and output data types displayed in the diagrams in the FFTdialog box as discussed in Dialog Box on page 1-49.Inputs to the FFT block are first cast to the output data type and storedin the output buffer. Each butterfly stage then processes signals in theaccumulator data type, with the final output of the butterfly being castback into the output data type. The block multiplies in a twiddle factorbefore each butterfly stage in a decimation-in-time FFT and after eachbutterfly stage in a decimation-in-frequency FFT.

    1-47

  • 2-D FFT

    The multiplier output appears in the accumulator data type becauseboth of the inputs to the multiplier are complex. For details on thecomplex multiplication performed, refer to Multiplication Data Types.

    1-48

  • 2-D FFT

    DialogBox

    The Main pane of the 2-D FFT dialog box appears as shown in thefollowing figure.

    1-49

  • 2-D FFT

    FFT implementationSet this parameter to FFTW [1], [2] to support an arbitrary lengthinput signal. The block restricts generated code with FFTWimplementation to host computers capable of running MATLAB.

    Set this parameter to Radix-2 for bit-reversed processing, fixedor floating-point data, or for portable C-code generation using theSimulink Coder. The dimensions of the input matrix, M and N,must be powers of two. To work with other input sizes, use theImage Pad block to pad or truncate these dimensions to powers oftwo, or if possible choose the FFTW implementation. See Radix-2Implementation on page 1-45.

    Set this parameter to Auto to let the block choose the FFTimplementation. For non-power-of-two transform lengths, theblock restricts generated code to MATLAB host computers.

    Output in bit-reversed orderDesignate the order of the output channel elements relative tothe ordering of the input elements. When you select this checkbox, the output channel elements appear in bit-reversed orderrelative to the input ordering. If you clear this check box, theoutput channel elements appear in linear order relative to theinput ordering.

    Linearly ordering the output requires extra data sortingmanipulation. For more information, see Bit-Reversed Orderon page 1-54.

    Scale result by FFT lengthWhen you select this parameter, the block divides the output ofthe FFT by the FFT length. This option is useful when you wantthe output of the FFT to stay in the same amplitude range as itsinput. This is particularly useful when working with fixed-pointdata types.

    The Data Types pane of the 2-D FFT dialog box appears as shown inthe following figure.

    1-50

  • 2-D FFT

    1-51

  • 2-D FFT

    Rounding modeSelect the Rounding Modes for fixed-point operations. The sinetable values do not obey this parameter; instead, they alwaysround to Nearest.

    Overflow modeSelect the Overflow mode for fixed-point operations. The sinetable values do not obey this parameter; instead, they are alwayssaturated.

    Sine table data typeChoose how you specify the word length of the values of the sinetable. The fraction length of the sine table values always equalsthe word length minus one. You can set this parameter to: A rule that inherits a data type, for example, Inherit: Same

    word length as input

    An expression that evaluates to a valid data type, for example,fixdt(1,16)

    The sine table values do not obey the Rounding mode andOverflow mode parameters; instead, they are always saturatedand rounded to Nearest.

    Product output data typeSpecify the product output data type. See Fixed-Point Data Typeson page 47 and Multiplication Data Types for illustrationsdepicting the use of the product output data type in this block.You can set this parameter to: A rule that inherits a data type, for example, Inherit:

    Inherit via internal rule

    An expression that evaluates to a valid data type, for example,fixdt(1,16,0)

    Click the Show data type assistant button todisplay the Data Type Assistant, which helps you set theProduct output data type parameter.

    1-52

  • 2-D FFT

    See Specify Data Types Using Data Type Assistant for moreinformation.

    Accumulator data typeSpecify the accumulator data type. See Fixed-Point Data Typeson page 47 for illustrations depicting the use of the accumulatordata type in this block. You can set this parameter to: A rule that inherits a data type, for example, Inherit:

    Inherit via internal rule

    An expression that evaluates to a valid data type, for example,fixdt(1,16,0)

    Click the Show data type assistant button todisplay the Data Type Assistant, which helps you set theAccumulator data type parameter.

    See Specify Data Types Using Data Type Assistant for moreinformation.

    Output data typeSpecify the output data type. See Fixed-Point Data Types on page47 for illustrations depicting the use of the output data type inthis block. You can set this parameter to: A rule that inherits a data type, for example, Inherit:

    Inherit via internal rule.When you select Inherit: Inherit via internal rule, theblock calculates the output word length and fraction lengthautomatically. The internal rule first calculates an ideal outputword length and fraction length using the following equations: When you select the Divide butterfly outputs by twocheck box, the ideal output word and fraction lengths are thesame as the input word and fraction lengths.

    1-53

  • 2-D FFT

    When you clear the Divide butterfly outputs by twocheck box, the block computes the ideal output word andfraction lengths according to the following equations:

    WL WL floor FFT lengthideal output input= + +(log ( ))2 1 1

    FL FLideal output input=

    Using these ideal results, the internal rule then selects wordlengths and fraction lengths that are appropriate for yourhardware. For more information, see Inherit via InternalRule.

    An expression that evaluates to a valid data type, for example,fixdt(1,16,0)

    Click the Show data type assistant button todisplay the Data Type Assistant, which helps you set theOutput data type parameter.

    See Specify Data Types Using Data Type Assistant for moreinformation.

    Lock data type settings against change by the fixed-point toolsSelect this parameter to prevent the fixed-point tools fromoverriding the data types you specify on the block mask. For moreinformation, see fxptdlg, a reference page on the Fixed-PointTool in the Simulink documentation.

    Example Bit-Reversed OrderTwo numbers are bit-reversed values of each other when the binaryrepresentation of one is the mirror image of the binary representationof the other. For example, in a three-bit system, one and fourare bit-reversed values of each other because the three-bit binaryrepresentation of one, 001, is the mirror image of the three-bit binary

    1-54

  • 2-D FFT

    representation of four, 100. The following diagram shows the rowindices in linear order. To put them in bit-reversed order

    1 Translate the indices into their binary representation with theminimum number of bits. In this example, the minimum number ofbits is three because the binary representation of 7 is 111.

    2 Find the mirror image of each binary entry, and write it beside theoriginal binary representation.

    3 Translate the indices back to their decimal representation.

    The row indices now appear in bit-reversed order.

    If, on the 2-D FFT block parameters dialog box, you select the Outputin bit-reversed order check box, the block bit-reverses the order ofboth the columns and the rows. The next diagram illustrates the linearand bit-reversed outputs of the 2-D FFT block. The output values arethe same, but they appear in different order.

    1-55

  • 2-D FFT

    245 13 10 5 10 5 13 9 0 4 15 9 21 6 15 9 21 6 13 99 1 14 3

    + +

    i i i i i. . . . . . .11 14 31 16 3 5 9 17 7 23 9 17 7 23 9 16 3 5 9

    18 5 6 3 19i i i i i i

    i i+ + +

    . . . . . . . . + + +

    + +

    24 5 4 4 3 10 4 5 7 16 4 12 4 11 4 5 5 1 418 5 6 3 5

    i i i i i ii i

    . . . . . . . .44 19 24 5 5 1 4 12 5 11 3 5 7 16 4 34 0 5

    4 3 10 3 1 1i i i i i i

    i+ + +

    . . . . . . .. . . ii i i i i i i + + +

    +

    5 6 13 1 11 5 11 27 6 6 6 2 6 3 4 8 7 6 2 138 4 2

    . . . . . . . . .. .44 11 9 18 4 25 1 4 5 1 1 3 4 5 4 17 6 9 4 2 2 13 1 2i i i i i i i+ + . . . . . . . . . .77

    8 4 2 4 11 9 4 5 1 1 18 4 25 1 0 6 2 7 2 2 13 17 6i

    i i i i i i. . . . . . . . . . + + + + 99 4 34 0 54 4 10 3 1 1 11 5 11 5 6 13 1 6 2 13 3 4 8

    . .. . . . . . . .

    i ii i i i

    +

    + + + .. . . .7 2 6 27 6 6 6i i i +

    7 6 7 1 3 6 2 31 3 7 8 7 0 1 64 4 3 1 3 5 1 63 6 7 4 3 3 5 47 7 0 2 6 6 2 36 5 2 1 4 4 4 73 1 6 0 1 5 1 60 3 00 5 5 3 5 5

    245 13 9 0 4 10 5 15 9 21 6 13 15 9 21 6 10 5 13 94 3 10

    . . . . . . ..

    + +

    i i i i i.. . . . . . . . . . .3 27 6 6 6 5 6 13 1 3 4 8 7 1 1 2 6 11 5 11 6 2 13i i i i i i i + + + ii

    i i i i i i i18 5 4 3 10 4 19 24 12 4 11 4 6 3 5 7 16 4 5 4 5 5 1 4 + + +. . . . . . . . iii i i i i i8 4 2 4 0 6 2 7 4 5 1 1 17 6 9 4 11 9 2 2 13 18 4 25. . . . . . . . . . + + + + .. .

    . . . . . . .1 34 0 5

    9 16 3 5 9 14 31 17 7 23 9 1 17 7 23 9 14 31 16i i

    i i i i i+

    + + + 33 5 98 4 2 4 3 4 5 4 18 4 25 1 2 2 13 1 11 9 17 6 9 4

    + + +

    .. . . . . . . . . .

    ii i i i i i

    + + +

    4 5 1 1 1 2 718 5 5 5 1 4 5 4 5 7 16 4 6 3 12 5 11 3

    . . .. . . . . .

    i ii i i i i i 119 24 4 3 10 4

    4 4 10 3 6 2 13 11 5 11 2 6 1 1 3 4 8+ +

    + + +

    i ii i i i i

    . .. . . . . . . .. . . . .7 5 6 13 1 27 6 6 6i i i +

    "#$

    %& $

    ! "

    ! "

    !"

    !"

    1-56

  • 2-D FFT

    References [1] FFTW (http://www.fftw.org)

    [2] Frigo, M. and S. G. Johnson, FFTW: An Adaptive SoftwareArchitecture for the FFT,Proceedings of the International Conference onAcoustics, Speech, and Signal Processing, Vol. 3, 1998, pp. 1381-1384.

    See Also 2-D DCT Computer Vision System Toolbox software2-D IDCT Computer Vision System Toolbox software2-D IFFT Computer Vision System Toolbox software2-D IFFT Computer Vision System Toolbox softwarebitrevorder Signal Processing Toolbox softwarefft MATLABifft MATLABSimulink Coder Simulink Coder

    1-57

  • 2-D FFT (To Be Removed)

    Purpose Compute two-dimensional fast Fourier transform of input

    Library Transforms

    DescriptionNote The 2-D FFT block is obsolete. It may be removed in a futureversion of the Computer Vision System Toolbox software. Use thereplacement block 2-D FFT.

    Refer to FFT and IFFT Support for Non-Power-of-Two TransformLength with FFTW Library in the R2011b Release Notes for detailsrelated to these changes.

    1-58

  • 2-D FIR Filter

    Purpose Perform 2-D FIR filtering on input matrix

    Library Filteringvisionfilter

    Description The 2-D Finite Impulse Response (FIR) filter block filters the inputmatrix I using the coefficient matrix H or the coefficient vectors HHand HV.

    Port Input/Output Supported Data TypesComplexValuesSupported

    I Vector or matrix ofintensity values

    Double-precision floating point Single-precision floating point Fixed point 8-, 16-, 32-bit signed integer 8-, 16-, 32-bit unsigned integer

    Yes

    H Matrix of filter coefficients Same as I port. YesHH Vector of filter coefficients Same as I port. The input to ports

    HH and HV must be the samedata type.

    Yes

    HV Vector of filter coefficients Same as I port. The input to portsHH and HV must be the samedata type.

    Yes

    PVal Scalar value thatrepresents the constantpad value

    Input must have the same datatype as the input to I port.

    Yes

    Output Scalar, vector, or matrixof filtered values

    Same as I port. Yes

    1-59

  • 2-D FIR Filter

    If the input has a floating-point data type, then the output uses thesame data type. Otherwise, the output can be any fixed-point data type.Select the Separable filter coefficients check box if your filtercoefficients are separable. Using separable filter coefficients reducesthe amount of calculations the block must perform to compute theoutput. For example, suppose your input image is M-by-N and yourfilter coefficient matrix is x-by-y. For a nonseparable filter with theOutput size parameter set to Same as input port I, it would take

    x y M N

    multiply-accumulate (MAC) operations for the block to calculate theoutput. For a separable filter, it would only take

    ( )x y M N+

    MAC operations. If you do not know whether or not your filtercoefficients are separable, use the isfilterseparable function.Here is an example of the function syntax, [S, HCOL, HROW] =isfilterseparable(H). The isfilterseparable function takes thefilter kernel, H, and returns S, HCOL and HROW. Here, S is a Booleanvariable that is 1 if the filter is separable and 0 if it is not. HCOL is avector of vertical filter coefficients, and HROW is a vector of horizontalfilter coefficients.Use the Coefficient source parameter to specify how to define yourfilter coefficients. If you select the Separable filter coefficients checkbox and then select a Coefficient source of Specify via dialog, theVertical coefficients (across height) and Horizontal coefficients(across width) parameters appear in the dialog box. You can use theseparameters to enter vectors of vertical and horizontal filter coefficients,respectively.You can also use the variables HCOL and HROW, the output of theisfilterseparable function, for these parameters. If you select theSeparable filter coefficients check box and then select a Coefficientsource of Input port, ports HV and HH appear on the block. Usethese ports to specify vectors of vertical and horizontal filter coefficients.

    1-60

  • 2-D FIR Filter

    If you clear the Separable filter coefficients check box and selecta Coefficient source of Specify via dialog, the Coefficientsparameter appears in the dialog box. Use this parameter to enter yourmatrix of filter coefficients.If you clear the Separable filter coefficients check box and select aCoefficient source of Input port, port H appears on the block. Usethis port to specify your filter coefficient matrix.The block outputs the result of the filtering operation at the Outputport. The Output size parameter and the sizes of the inputs at ports Iand H dictate the dimensions of the output. For example, assume thatthe input at port I has dimensions (Mi, Ni) and the input at port H hasdimensions (Mh, Nh). If you select anOutput size of Full, the outputhas dimensions (Mi+Mh-1, Ni+Nh-1). If you select an Output size ofSame as input port I, the output has the same dimensions as theinput at port I. If you select an Output size of Valid, the block filtersthe input image only where the coefficient matrix fits entirely withinit, so no padding is required. The output has dimensions (Mi-Mh+1,Ni-Nh+1). However, if all(size(I)

  • 2-D FIR Filter

    Use the Filtering based on parameter to specify the algorithm bywhich the block filters the input matrix. If you select Convolution andset the Output size parameter to Full, the block filters your inputusing the following algorithm

    C i j A m n H i m j nn

    Na

    m

    Ma( , ) ( , ) * ( , )

    ( )( )=

    =

    =

    0

    1

    0

    1

    where 0 1 < + i Ma Mh and 0 1 < + j Na Nh . If you selectCorrelation and set the Output size parameter to Full, the blockfilters your input using the following algorithm

    C i j A m n conj H m i n jn

    Na

    m

    Ma( , ) ( , ) ( ( , ))

    ( )( )= + +

    =

    =

    0

    1

    0

    1

    where 0 1 < + i Ma Mh and 0 1 < + j Na Nh .TThe imfilter function from the Image Processing Toolbox productsimilarly performs N-D filtering of multidimensional images.

    Fixed-Point Data Types

    The following diagram shows the data types used in the 2-D FIR Filterblock for fixed-point signals.

    CAST ADDER CASTCOMPLEXMULTIPLIER

    Input (A) data type

    Filter coefficient (H) data type

    Accumulator or Product output data type

    Accumulator data type

    Output (C) data typeAccumulator

    data type

    The result of each addition remainsin the accumulator data type

    1-62

  • 2-D FIR Filter

    You can set the coefficient, product output, accumulator, and outputdata types in the block mask as discussed in Dialog Box on page 1-63.The output of the multiplier is in the product output data type if atleast one of the inputs to the multiplier is real. If both of the inputsto the multiplier are complex, the result of the multiplication is inthe accumulator data type. For details on the complex multiplicationperformed, refer to Multiplication Data Types.

    DialogBox

    The Main pane of the 2-D FIR Filter dialog box appears as shown inthe following figure.

    1-63

  • 2-D FIR Filter

    Separable filter coefficientsSelect this check box if your filter coefficients are separable. Usingseparable filter coefficients reduces the amount of calculations theblock must perform to compute the output.

    Coefficient sourceSpecify how to define your filter coefficients. Select Specify viadialog to enter your coefficients in the block parameters dialogbox. Select Input port to specify your filter coefficient matrixusing port H or ports HH and HV.

    CoefficientsEnter your real or complex-valued filter coefficient matrix. Thisparameter appears if you clear the Separable filter coefficientscheck box and then select a Coefficient source of Specify viadialog. Tunable.

    Vertical coefficients (across height)Enter the vector of vertical filter coefficients for your separablefilter. This parameter appears if you select the Separable filtercoefficients check box and then select aCoefficient source ofSpecify via dialog.

    Horizontal coefficients (across width)Enter the vector of horizontal filter coefficients for your separablefilter. This parameter appears if you select the Separable filtercoefficients check box and then select aCoefficient source ofSpecify via dialog.

    Output sizeThis parameter controls the size of the filtered output. If youchoose Full, the output has dimensions (Ma+Mh-1, Na+Nh-1).If you choose Same as input port I, the output has the samedimensions as the input at port I If you choose Valid, output hasdimensions (Ma-Mh+1, Na-Nh+1).

    Padding optionsSpecify how to pad the boundary of your input matrix. SelectConstant to pad your matrix with a constant value. SelectReplicate to pad your input matrix by repeating its border

    1-64

  • 2-D FIR Filter

    values. Select Symmetricto pad your input matrix with its mirrorimage. Select Circular to pad your input matrix using a circularrepetition of its elements. This parameter appears if you select anOutput size of Full or Same as input port I.

    Pad value sourceUse this parameter to specify how to define your constantboundary value. Select Specify via dialog to enter your valuein the block parameters dialog box. Select Input port to specifyyour constant value using the PVal port. This parameter appearsif you select a Padding options of Constant.

    Pad valueEnter the constant value with which to pad your matrix. Thisparameter is visible if, for the Pad value source parameter, youselect Specify via dialog. Tunable. The pad value must be realif the input image is real. You will get an error message if the padvalue is complex when the input image is real.

    Filtering based onSpecify the algorithm by which the block filters the input matrix.You can select Convolution or Correlation.

    The Data Types pane of the 2-D FIR Filter dialog box appears asshown in the following figure.

    1-65

  • 2-D FIR Filter

    Rounding modeSelect the Rounding Modes for fixed-point operations.

    Overflow modeSelect the Overflow mode for fixed-point operations.

    CoefficientsChoose how to specify the word length and the fraction lengthof the filter coefficients. When you select Inherit: Same word length as input,the word length of the filter coefficients match that of theinput to the block. In this mode, the block automatically sets

    1-66

  • 2-D FIR Filter

    the fraction length of the coefficients to the binary-point onlyscaling that provides you with the best precision possible giventhe value and word length of the coefficients.

    When you select fixdt(1,16), you can enter the word length ofthe coefficients, in bits. In this mode, the block automaticallysets the fraction length of the coefficients to the binary-pointonly scaling that provides you with the best precision possiblegiven the value and word length of the coefficients.

    When you select fixdt(1,16,0), you can enter the word lengthand the fraction length of the coefficients, in bits.

    When you select , you can enter thedata type expression.

    The filter coefficients do not obey the Rounding mode and theOverflow mode parameters; instead, they always saturated androunded to Nearest.

    Click the Show data type assistant button todisplay the Data Type Assistant, which helps you set theProduct output data type parameter.

    See Specify Data Types Using Data Type Assistant for moreinformation.

    Product outputUse this parameter to specify how to designate the product outputword and fraction lengths. Refer to Fixed-Point Data Typeson page 1-62 and Multiplication Data Types for illustrationsdepicting the use of the product output data type in this block: When you select Inherit: Same as input, thesecharacteristics match those of the input to the block.

    When you select fixdt([],16,0), you can enter the wordlength and the fraction length of the product output, in bits.

    1-67

  • 2-D FIR Filter

    When you select , you can enter thedata type expression.

    If you set the Coefficent source (on theMain tab) to Input portthe Product Output will inherit its sign according to the inputs.If either or both input I1 and I2 are signed, the Product Outputwill be signed. Otherwise, the Product Output is unsigned. Thefollowing table shows all cases.

    Sign of Input I1 Sign of Input I2 Sign of ProductOutput

    unsigned unsigned unsignedunsigned signed signedsigned unsigned signedsigned signed signed

    Click the Show data type assistant button todisplay the Data Type Assistant, which helps you set theProduct output data type parameter.

    See Specify Data Types Using Data Type Assistant for moreinformation.

    AccumulatorUse this parameter to specify how to designate the accumulatorword and fraction lengths. Refer to Fixed-Point Data Types onpage 1-62 and Multiplication Data Types in the DSP SystemToolbox documentation for illustrations depicting the use of theaccumulator data type in this block. The accumulator data type isonly used when both inputs to the multiplier are complex: When you select Inherit: Same as input, thesecharacteristics match those of the input to the block.

    When you select Inherit: Same as product output, thesecharacteristics match those of the product output.

    1-68

  • 2-D FIR Filter

    When you select fixdt([],16,0), you can enter the wordlength and the fraction length of the accumulator, in bits.

    When you select Slope and bias scaling, you can enter theword length, in bits, and the slope of the accumulator. Allsignals in the Computer Vision System Toolbox software havea bias of 0.

    Click the Show data type assistant button todisplay the Data Type Assistant, which helps you set theProduct output data type parameter.

    See Specify Data Types Using Data Type Assistant for moreinformation.

    OutputChoose how to specify the word length and fraction length of theoutput of the block: When you select Inherit: Same as input, thesecharacteristics match those of the input to the block.

    When you select fixdt([],16,0), you can enter the wordlength and the fraction length of the output, in bits.You can choose to set signedness of the output to Auto, Signedor Unsigned.

    When you select , you can enter thea data type expression.

    Click the Show data type assistant button todisplay the Data Type Assistant, which helps you set theProduct output data type parameter.

    See Specify Data Types Using Data Type Assistant for moreinformation.

    1-69

  • 2-D FIR Filter

    Lock data type settings against change by the fixed-point toolsSelect this parameter to prevent the fixed-point tools fromoverriding the data types you specify on the block mask. For moreinformation, see fxptdlg, a reference page on the Fixed-PointTool in the Simulink documentation.

    See Also imfilter Image Processing Toolbox

    1-70

  • 2-D Histogram

    Purpose Generate histogram of input or sequence of inputs

    Library Statisticsvisionstatistics

    Description The 2-D Histogram block computes the frequency distribution of theelements in the input. You must use the Find the histogram overparameter to specify whether the block computes the histogram forEach column of the input or of the Entire input. The Runninghistogram check box allows you to select between basic operation andrunning operation, as described below.The block distributes the elements of the input into the number ofdiscrete bins specified by the Number of bins parameter, n.

    y = hist(u,n) % Equivalent MATLAB code

    The 2-D Histogram block sorts all complex input values into binsaccording to their magnitude.The histogram value for a given bin represents the frequency ofoccurrence of the input values bracketed by that bin. You specifythe upper boundary of the highest-valued bin in the Upper limit ofhistogram parameter, BM, and the lower boundary of the lowest-valuedbin in the Lower limit of histogram parameter, Bm. The bins haveequal width of

    B Bn

    M m

    and centers located at

    B k k nm

    12

    0 1 2 1, , ,...,

    Input values that fall on the border between two bins are placed intothe lower valued bin; that is, each bin includes its upper boundary.For example, a bin of width 4 centered on the value 5 contains the

    1-71

  • 2-D Histogram

    input value 7, but not the input value 3. Input values greater thanthe Upper limit of histogram parameter or less than Lower limitof histogram parameter are placed into the highest valued or lowestvalued bin, respectively.The values you enter for the Upper limit of histogram and Lowerlimit of histogram parameters must be real-valued scalars. NaN andinf are not valid values for the Upper limit of histogram and Lowerlimit of histogram parameters.

    Basic Operation

    When the Running histogram check box is not selected, the 2-DHistogram block computes the frequency distribution of the currentinput.When you set the Find the histogram over parameter to Eachcolumn, the 2-D Histogram block computes a histogram for each columnof the M-by-N matrix independently. The block outputs an n-by-Nmatrix, where n is the Number of bins you specify. The jth column ofthe output matrix contains the histogram for the data in the jth columnof the M-by-N input matrix.When you set the Find the histogram over parameter to Entireinput, the 2-D Histogram block computes the frequency distributionfor the entire input vector, matrix or N-D array. The block outputs ann-by-1 vector, where n is the Number of bins you specify.

    Running Operation

    When you select the Running histogram check box, the 2DHistogram block computes the frequency distribution of both the pastand present data for successive inputs. The block resets the histogram(by emptying all of the bins) when it detects a reset event at the optionalRst port. See Resetting the Running Histogram on page 1-73 for moreinformation on how to trigger a reset.When you set the Find the histogram over parameter to Eachcolumn, the 2-D Histogram block computes a running histogram foreach column of theM-by-N matrix. The block outputs an n-by-N matrix,where n is the Number of bins you specify. The jth column of the

    1-72

  • 2-D Histogram

    output matrix contains the running histogram for the jth column ofthe M-by-N input matrix.When you set the Find the histogram over parameter to Entireinput, the 2-D Histogram block computes a running histogram for thedata in the first dimension of the input. The block outputs an n-by-1vector, where n is the Number of bins you specify.

    Note When the 2-D Histogram block is used in running mode andthe input data type is non-floating point, the output of the histogramis stored as a uint32 data type. The largest number that can berepresented by this data type is 232-1. If the range of the uint32 datatype is exceeded, the output data will wrap back to 0.

    Resetting the Running Histogram

    The block resets the running histogram whenever a reset event isdetected at the optional Rst port. The reset signal and the input datasignal must be the same rate.You specify the reset event using the Reset port menu:

    None Disables the Rst port

    Rising edge Triggers a reset operation when the Rst input doesone of the following:- Rises from a negative value to a positive value or zero- Rises from zero to a positive value, where the rise is not acontinuation of a rise from a negative value to zero (see thefollowing figure)

    1-73

  • 2-D Histogram

    Falling edge Triggers a reset operation when the Rst input doesone of the following:- Falls from a positive value to a negative value or zero- Falls from zero to a negative value, where the fall is not acontinuation of a fall from a positive value to zero (see the followingfigure)

    1-74

  • 2-D Histogram

    Either edge Triggers a reset operation when the Rst input is aRising edge or Falling edge (as described earlier)

    Non-zero sample Triggers a reset operation at each sample timethat the Rst input is not zero

    DialogBox

    TheMain pane of the 2-D Histogram block dialog appears as follows.

    1-75

  • 2-D Histogram

    Lower limit of histogramEnter a real-valued scalar for the lower boundary, Bm, of thelowest-valued bin. NaN and inf are not valid values for Bm.Tunable.

    1-76

  • 2-D Histogram

    Upper limit of histogramEnter a real-valued scalar for the upper boundary, BM, of thehighest-valued bin. NaN and inf are not valid values for BM.Tunable.

    Number of binsThe number of bins, n, in the histogram.

    Find the histogram overSpecify whether the block finds the histogram over the entireinput or along each column of the input.

    Note The option will be removed in a future release.

    NormalizedWhen selected, the output vector, v, is normalized such thatsum(v) = 1.

    Use of this parameter is not supported for fixed-point signals.Running histogram

    Set to enable the running histogram operation, and clear to enablebasic histogram operation. For more information, see BasicOperation on page 1-72 and Running Operation on page 1-72.

    Reset portThe type of event that resets the running histogram. For moreinformation, see Resetting the Running Histogram on page 1-73.The reset signal and the input data signal must be the same rate.This parameter is enabled only when you select the Runninghistogram check box. For more information, see RunningOperation on page 1-72.

    The Data Types pane of the 2-D Histogram block dialog appears asfollows.

    1-77

  • 2-D Histogram

    Note The fixed-point parameters listed are only used for fixed-pointcomplex inputs, which are distributed by squared magnitude.

    1-78

  • 2-D Histogram

    Rounding modeSelect the Rounding Modes for fixed-point operations.

    Overflow modeSelect the Overflow mode for fixed-point operations.

    Product output data typeSpecify the product output data type. See Multiplication DataTypes for illustrations depicting the use of the product outputdata type. You can set it to: A rule that inherits a data type, for example, Inherit:

    Inherit via internal rule

    An expression that evaluates to a valid data type, for example,fixdt([],16,0)

    Click the Show data type assistant button todisplay the Data Type Assistant, which helps you set theProduct output data type parameter.

    See Specify Data Types Using Data Type Assistant for moreinformation.

    Accumulator data typeSpecify the accumulator data type. You can set this parameter to: A rule that inherits a data type, for example, Inherit:

    Inherit via internal rule

    An expression that evaluates to a valid data type, for example,fixdt([],16,0)

    Click the Show data type assistant button todisplay the Data Type Assistant, which helps you set theAccumulator data type parameter.

    See Specify Data Types Using Data Type Assistant for moreinformation.

    1-79

  • 2-D Histogram

    SupportedDataTypes

    Port Supported Data Types

    In Double-precision floating point Single-precision floating point Fixed point (signed and unsigned) 8-, 16-, and 32-bit signed integers 8-, 16-, and 32-bit unsigned integers

    Output Double-precision floating point Single-precision floating point 32-bit unsigned integers

    Rst Double-precision floating point Single-precision floating point Boolean 8-, 16-, and 32-bit signed integers 8-, 16-, and 32-bit unsigned integers

    Examples Calculate Histogram of R, G, and B ValuesThe Histogram Display example uses the Histogram block to calculatethe histograms of R, G, and B values in each video frame.

    See Also hist MATLAB

    1-80

  • 2-D Histogram (To Be Removed)

    Purpose Generate histogram of each input matrix

    Library Statistics

    DescriptionNote The 2-D Histogram block is obsolete. It may be removed in afuture version of the Computer Vision System Toolbox software. Usethe replacement block Histogram.

    Refer to Conventions Changed for Indexing, Spatial Coordinates, andRepresentation of Geometric Transforms in the R2011b Release Notesfor details related to these changes.

    1-81

  • 2-D IDCT

    Purpose Compute 2-D inverse discrete cosine transform (IDCT)

    Library Transformsvisiontransforms

    Description The 2-D IDCT block calculates the two-dimensional inversediscrete cosine transform of the input signal. The equation for thetwo-dimensional IDCT is

    f x yMN

    C m C n F m nx m

    My

    n

    N

    m

    M( , ) ( ) ( ) ( , ) cos

    ( )cos

    (=

    + +

    =

    =

    2 2 122

    0

    1

    0

    1 112

    )nN

    where F(m,n) is the DCT of the signal f(x,y) andC m C n( ), ( ) = 1

    2 form n, = 0 and C m C n( ), ( ) = 1 otherwise.The number of rows and columns of the input signal must be powersof two. The output of this block has dimensions the same dimensionsas the input.

    Port Input/Output Supported Data TypesComplexValuesSupported

    Input Vector or matrix ofintensity values

    Double-precision floatingpoint

    Single-precision floatingpoint

    Fixed point 8-, 16-, 32-bit signed integer 8-, 16-, 32-bit unsignedinteger

    No

    Output 2-D IDCT of the input Same as Input port No

    1-82

  • 2-D IDCT

    If the data type of the input signal is floating point, the output of theblock is the same data type.Use the Sine and cosine computation parameter to specify how theblock computes the sine and cosine terms in the IDCT algorithm. Ifyou select Trigonometric fcn, the block computes the sine and cosinevalues during the simulation. If you select Table lookup, the blockcomputes and stores the trigonometric values before the simulationstarts. In this case, the block requires extra memory.

    Fixed-Point Data Types

    The following diagram shows the data types used in the 2-D IDCT blockfor fixed-point signals. Inputs are first cast to the output data type andstored in the output buffer. Each butterfly stage processes signals inthe accumulator data type, with the final output of the butterfly beingcast back into the output data type.

    1-83

  • 2-D IDCT

    1-84

  • 2-D IDCT

    The output of the multiplier is in the product output data type whenat least one of the inputs to the multiplier is real. When both of theinputs to the multiplier are complex, the result of the multiplication isin the accumulator data type. For details on the complex multiplicationperformed, refer to Multiplication Data Types. You can set the sinetable, product output, accumulator, and output data types in the blockmask as discussed in the next section.

    DialogBox

    The Main pane of the 2-D IDCT dialog box appears as shown in thefollowing figure.

    Sine and cosine computationSpecify how the block computes the sine and cosine terms in theIDCT algorithm. If you select Trigonometric fcn, the blockcomputes the sine and cosine values during the simulation. If

    1-85

  • 2-D IDCT

    you select Table lookup, the block computes and stores thetrigonometric values before the simulation starts. In this case, theblock requires extra memory.

    The Data Types pane of the 2-D IDCT dialog box appears as shown inthe following figure.

    Rounding modeSelect the Rounding Modes for fixed-point operations.

    Overflow modeSelect the Overflow mode for fixed-point operations. The sinetable values do not obey this parameter; instead, they are alwayssaturated.

    1-86

  • 2-D IDCT

    Sine table data typeChoose how you specify the word length of the values of the sinetable. The fraction length of the sine table values always equalsthe word length minus one. You can set this parameter to: A rule that inherits a data type, for example, Inherit: Same

    word length as input

    An expression that evaluates to a valid data type, for example,fixdt(1,16)

    The sine table values do not obey the Rounding mode andOverflow mode parameters; instead, they are always saturatedand rounded to Nearest.

    Product output data typeSpecify the product output data type. See Fixed-Point DataTypes on page 1-83 and Multiplication Data Types forillustrations depicting the use of the product output data type inthis block. You can set this parameter to: A rule that inherits a data type, for example, Inherit:

    Inherit via internal rule

    An expression that evaluates to a valid data type, for example,fixdt(1,16,0)

    Click the Show data type assistant button todisplay the Data Type Assistant, which helps you set theProduct output data type parameter.

    See Specify Data Types Using Data Type Assistant for moreinformation.

    Accumulator data typeSpecify the accumulator data type. See Fixed-Point Data Typeson page 1-83 for illustrations depicting the use of the accumulatordata type in this block. You can set this parameter to:

    1-87

  • 2-D IDCT

    A rule that inherits a data type, for example, Inherit:Inherit via internal rule

    An expression that evaluates to a valid data type, for example,fixdt(1,16,0)

    Click the Show data type assistant button todisplay the Data Type Assistant, which helps you set theAccumulator data type parameter.

    See Specify Data Types Using Data Type Assistant for moreinformation.

    Output data typeSpecify the output data type. See Fixed-Point Data Types onpage 1-83 for illustrations depicting the use of the output datatype in this block. You can set this parameter to: A rule that inherits a data type, for example, Inherit:

    Inherit via internal rule.When you select Inherit: Inherit via internal rule, theblock calculates the output word length and fraction lengthautomatically. The internal rule first calculates an ideal outputword length and fraction length using the following equations:

    WL WL floor DCT lengthideal output input= + +(log ( ))2 1 1

    FL FLideal output input=

    Using these ideal results, the internal rule then selects wordlengths and fraction lengths that are appropriate for yourhardware. For more information, see Inherit via InternalRule.

    An expression that evaluates to a valid data type, for example,fixdt(1,16,0)

    1-88

  • 2-D IDCT

    Click the Show data type assistant button todisplay the Data Type Assistant, which helps you set theOutput data type parameter.

    See Specify Data Types Using Data Type Assistant for moreinformation.

    Lock scaling against changes by the autoscaling toolSelect this parameter to prevent any fixed-point scaling youspecify in this block mask from being overridden by theautoscaling tool in the Fixed-Point Tool. For more information,see fxptdlg, a reference page on the Fixed-Point Tool in theSimulink documentation.

    Lock data type settings against change by the fixed-point toolsSelect this parameter to prevent the fixed-point tools fromoverriding the data types you specify on the block mask. For moreinformation, see fxptdlg, a reference page on the Fixed-PointTool in the Simulink documentation.

    References [1] Chen, W.H, C.H. Smith, and S.C. Fralick, A fast computationalalgorithm for the discrete cosine transform,IEEE Trans. Commun.,vol. COM-25, pp. 1004-1009. 1977.

    [2] Wang, Z. Fast algorithms for the discrete W transform and forthe discrete Fourier transform, IEEE Trans. Acoust., Speech, SignalProcessing, vol. ASSP-32, pp. 803-816, Aug. 1984.

    See Also 2-D DCT Computer Vision System Toolbox software2-D FFT Computer Vision System Toolbox software2-D IFFT Computer Vision System Toolbox software

    1-89

  • 2-D IFFT

    Purpose 2-D Inverse fast Fourier transform of input

    Library Transformsvisiontransforms

    Description The 2-D IFFT block computes the inverse fast Fourier transform(IFFT) of an M-by-N input matrix in two steps. First, it computes theone-dimensional IFFT along one dimension (row or column). Next,it computes the IFFT of the output of the first step along the otherdimension (column or row).The output of the IFFT block is equivalent to the MATLAB ifft2function:

    y = ifft2(A) % Equivalent MATLAB code

    Computing the IFFT of each dimension of the input matrix is equivalentto calculating the two-dimensional inverse discrete Fourier transform(IDFT), which is defined by the following equation:

    f x yMN

    F m n e ej

    mxM

    n

    N

    m

    M jny

    N( , ) ( , )==

    =

    12

    0

    1

    0

    1 2

    where 0 1 x M and 0 1 y N .The output of this block has the same dimensions as the input. Ifthe input signal has a floating-point data type, the data type of theoutput signal uses the same floating-point data type. Otherwise, theoutput can be any fixed-point data type. The block computes scaledand unscaled versions of the IFFT.The input to this block can be floating-point or fixed-point, real orcomplex, and conjugate symmetric. The block uses one of two possibleFFT implementations. You can select an implementation based on theFFTW library [1], [2], or an implementation based on a collection ofRadix-2 algorithms. You can select Auto to allow the block to choosethe implementation.

    1-90

  • 2-D IFFT

    Port Description

    Port Description Supported Data TypesComplexValuesSupported

    Input Vector or matrix ofintensity values

    Double-precisionfloating point

    Single-precisionfloating point

    Fixed point 8-, 16-, 32-bit signedinteger

    8-, 16-, 32-bit unsignedinteger

    Yes

    Output 2-D IFFT of theinput

    Same as Input port Yes

    FFTW Implementation

    The FFTW implementation provides an optimized FFT calculationincluding support for power-of-two and non-power-of-two transformlengths in both simulation and code generation. Generated codeusing the FFTW implementation will be restricted to MATLAB hostcomputers. The data type must be floating-point. Refer to SimulinkCoder for more details on generating code.

    Radix-2 Implementation

    The Radix-2 implementation supports bit-reversed processing, fixed orfloating-point data, and allows the block to provide portable C-codegeneration using the Simulink Coder. The dimensions of the inputmatrix, M and N, must be powers of two. To work with other inputsizes, use the Image Pad block to pad or truncate these dimensions topowers of two, or if possible choose the FFTW implementation.

    1-91

  • 2-D IFFT

    With Radix-2 selected, the block implements one or more of thefollowing algorithms:

    Butterfly operation Double-signal algorithm Half-length algorithm Radix-2 decimation-in-time (DIT) algorithm Radix-2 decimation-in-frequency (DIF) algorithm

    Radix-2 Algorithms for Real or Complex Input ComplexityFloating-Point Signals

    Parameter Settings Algorithms Used for IFFT Computation

    Butterfly operation and radix-2 DIT

    Radix-2 DIF

    Butterfly operation and radix-2 DIT in conjunctionwith the half-length and double-signal algorithms

    Radix-2 DIF in conjunction with the half-length anddouble-signal algorithms

    1-92

  • 2-D IFFT

    Radix-2 Algorithms for Real or Complex Input ComplexityFixed-Point Signals

    Other Parameter Settings Algorithms Used for IFFT Computation

    Butterfly operation and radix-2 DIT

    Radix-2 DIF

    Note The Input is conjugate symmetric parameter cannot be usedfor fixed-point signals.

    Radix-2 Optimization for the Table of Trigonometric ValuesIn certain situations, the blocks Radix2 algorithm computes all thepossible trigonometric values of the twiddle factor

    ej

    kK

    2

    where K is the greater value of either M or N and k K= 0 1, , .The block stores these values in a table and retrieves them duringsimulation. The number of table entries for fixed-point andfloating-point is summarized in the following table:

    Number of Table Entries for N-Point FFT

    floating-point 3 N/4fixed-point N

    Fixed-Point Data TypesThe following diagrams show the data types used in the IFFT block forfixed-point signals. You can set the sine table, accumulator, product

    1-93

  • 2-D IFFT

    output, and output data types displayed in the diagrams in the IFFTdialog box as discussed in Dialog Box on page 1-96.Inputs to the IFFT block are first cast to the output data type and storedin the output buffer. Each butterfly stage then processes signals in theaccumulator data type, with the final output of the butterfly being castback into the output data type. The block multiplies in a twiddle factorbefore each butterfly stage in a decimation-in-time IFFT and after eachbutterfly stage in a decimation-in-frequency IFFT.

    1-94

  • 2-D IFFT

    The multiplier output appears in the accumulator data type becauseboth of the inputs to the multiplier are complex. For details on thecomplex multiplication performed, refer to Multiplication Data Typesin the DSP System Toolbox documentation.

    1-95

  • 2-D IFFT

    DialogBox

    The Main pane of the 2-D IFFT dialog box appears as shown in thefollowing figure.

    1-96

  • 2-D IFFT

    1-97

  • 2-D IFFT

    FFT implementationSet this parameter to FFTW [1], [2] to support an arbitrary lengthinput signal. The block restricts generated code with FFTWimplementation to MATLAB host computers.

    Set this parameter to Radix-2 for bit-reversed processing, fixedor floating-point data, or for portable C-code generation using theSimulink Coder. The dimensions of the input matrix, M and N,must be powers of two. To work with other input sizes, use theImage Pad block to pad or truncate these dimensions to powers oftwo, or if possible choose the FFTW implementation. See Radix-2Implementation on page 1-91.

    Set this parameter to Auto to let the block choose the FFTimplementation. For non-power-of-two transform lengths, theblock restricts generated code to MATLAB host computers.

    Input is in bit-reversed orderSelect or clear this check box to designate the order of the inputchannel elements. Select this check box when the input shouldappear in reversed order, and clear it when the input shouldappear in linear order. The block yields invalid outputs when youdo not set this parameter correctly. This check box only appearswhen you set the FFT implementation parameter to Radix-2or Auto.

    For more information ordering of the output, see Bit-ReversedOrder on page 1-54. The 2-D FFT block bit-reverses the order ofboth the columns and the rows.

    Input is conjugate symmetricSelect this option when the block inputs both floating point andconjugate symmetric, and you want real-valued outputs. Thisparameter cannot be used for fixed-point signals. Selecting thischeck box optimizes the blocks computation method.

    The FFT block yields conjugate symmetric output when you inputreal-valued data. Taking the IFFT of a conjugate symmetric input

    1-98

  • 2-D IFFT

    matrix produces real-valued output. Therefore, if the input to theblock is both floating point and conjugate symmetric, and youselect the this check box, the block produces real-valued outputs.

    If the IFFT block inputs conjugate symmetric data and you do notselect this check box, the IFFT block outputs a complex-valuedsignal with small imaginary parts. The block outputs invalid dataif you select this option with non conjugate symmetric input data.

    Divide output by product of FFT length in each input dimensionSelect this check box to compute the scaled IFFT. The blockcomputes scaled and unscaled versions of the IFFT. If you selectthis option, the block computes the scaled version of the IFFT.The unscaled IFFT is defined by the following equation:

    f x y F m n e ej

    mxM

    n

    N

    m

    M jny

    N( , ) ( , )==

    =

    2

    0

    1

    0

    1 2

    where 0 1 x M and 0 1 y N .

    The scaled version of the IFFT multiplies the above unscaled

    version by 1MN

    .

    The Data Types pane of the 2-D IFFT dialog box appears as shown inthe following figure.

    1-99

  • 2-D IFFT

    1-100

  • 2-D IFFT

    Rounding modeSelect the Rounding Modes for fixed-point operations. The sinetable values do not obey this parameter; instead, they alwaysround to Nearest.

    Overflow modeSelect the Overflow mode for fixed-point operations. The sinetable values do not obey this parameter; instead, they are alwayssaturated.

    Sine table data typeChoose how you specify the word length of the values of the sinetable. The fraction length of the sine table values always equalsthe word length minus one. You can set this parameter to: A rule that inherits a data type, for example, Inherit: Same

    word length as input

    An expression that evaluates to a valid data type, for example,fixdt(1,16)

    The sine table values do not obey the Rounding mode andOverflow mode parameters; instead, they are always saturatedand rounded to Nearest.

    Product output data typeSpecify the product output data type. See Fixed-Point Data Typeson page 93 and Multiplication Data Types for illustrationsdepicting the use of the product output data type in this block.You can set this parameter to: A rule that inherits a data type, for example, Inherit:

    Inherit via internal rule

    An expression that evaluates to a valid data type, for example,fixdt(1,16,0)

    Click the Show data type assistant button todisplay the Data Type Assistant, which helps you set theProduct output data type parameter.

    1-101

  • 2-D IFFT

    See Specify Data Types Using Data Type Assistant for moreinformation.

    Accumulator data typeSpecify the accumulator data type. SeeFixed-Point Data Types onpage 93 for illustrations depicting the use of the accumulator datatype in this block. You can set this parameter to: A rule that inherits a data type, for example, Inherit:

    Inherit via internal rule

    An expression that evaluates to a valid data type, for exampl