Class Dft2dFast

java.lang.Object
imagingbook.spectral.dft.Dft2dFast
All Implemented Interfaces:
Dft2d
Direct Known Subclasses:
Dft2dFast.Double, Dft2dFast.Float

public abstract class Dft2dFast extends Object

Fast implementation of the 2-dimensional DFT using 1D FFTs. Note that this class has no public constructor - instantiate sub-class Dft2dDirect.Float or Dft2dDirect.Double instead, as shown below. See Ch. 19 of [1] for additional details.

Usage example (for float data):

 float[][] re = {{1, 2, 3}, {4, 5, 6}, {7, 8, 9}, {-2, -1, 0}};
 float[][] im = {{0, 0, 0}, {0, 0, 0}, {0, 0, 0}, {0, 0, 0}};
 int w = re.length;       // w = 4
 int h = re[0].length;    // h = 3
 Dft2d.Float dft = new Dft2dFast.Float(w, h);
 dct.forward(re, im);  // re/im now is the 2D DFT spectrum
 dct.inverse(re, im);  // re/im now is the original 2D signal 
 ...

[1] W. Burger, M.J. Burge, Digital Image Processing – An Algorithmic Introduction, 3rd ed, Springer (2022).

See Also:
  • Method Details

    • getWidth

      public int getWidth()
      Description copied from interface: Dft2d
      Returns the 'width' of the 2D data array (length of dimension 0). Data arrays are indexed as data[x][y], with 0 ≤ x < width and 0 ≤ y < height.
      Specified by:
      getWidth in interface Dft2d
      Returns:
      the width of the 2D data array
    • getHeight

      public int getHeight()
      Description copied from interface: Dft2d
      Returns the 'height' of the 2D data array (length of dimension 1). Data arrays are indexed as data[x][y], with 0 ≤ x < width and 0 ≤ y < height.
      Specified by:
      getHeight in interface Dft2d
      Returns:
      the height of the 2D data array
    • getScalingMode

      public ScalingMode getScalingMode()
      Description copied from interface: Dft2d
      Returns the scaling mode of this DFT (see ScalingMode).
      Specified by:
      getScalingMode in interface Dft2d
      Returns:
      the scaling mode of this DFT.