public abstract class FFTUtil
extends java.lang.Object
Constructor and Description |
---|
FFTUtil() |
Modifier and Type | Method and Description |
---|---|
static double |
abs(int pos,
double[] array)
Computes the absolute value of the complex number at position pos in the array
|
static double |
abs(int posx,
int posy,
double[][] array)
Computes the absolute values of the complex number at posx, posy in the 2D array array.
|
static Grid2D |
apply2DFilter(Grid2D imp,
Grid2D filter)
Applies a 2D filter to the an ImageProcessor
|
static Grid2D |
applyRampFilter_ECC(Grid2D imp,
RampFilter ramp)
Applies a ramp filter to the an ImageProcessor
|
static double[] |
applyRampFilter(double[] detectorRow,
RampFilter ramp)
Applies a ramp filter to the a detector row
|
static Grid2D |
applyRampFilter(Grid2D imp,
RampFilter ramp)
Applies a ramp filter to the an ImageProcessor
|
static double[] |
complexOneOverPiT(int width) |
static double[] |
complexSignum(double[] array)
Computes the complex signum for the given array.
|
static double[] |
cSignum(double[] array)
Computes the signum for the given complex array.
|
static double[] |
discreteHilbertTransform(double[] array,
int nTimes) |
static double[] |
divideAbsolute(double[] one,
double[] two)
Divides two arrays of complex numbers.
|
static double[] |
divideComplex(double realOne,
double imagOne,
double realTwo,
double imagTwo)
Divides two complex values
|
static double[] |
estimateFilter(Grid2D after,
Grid2D before,
double threshold,
boolean meanSquare)
Estimates the applied ramp filter given an input and an output image.
|
static Grid2D |
estimateFilter2D(Grid2D before,
Grid2D after,
double threshold)
Estimates the applied filter given an input and an output image.
|
static double[] |
exactFiniteHilbertTransform(double[] array,
int nTimes)
Exact finite discrete Hilbert transformation after Kak SC.
|
static double[] |
fft(double[] array) |
static double[] |
fft(double[] array,
int padding) |
static double[][] |
fftshift(double[][] data,
boolean bComplex,
boolean bSign)
shift zero frequency to center, or vice verse, 2D.
|
static double[] |
fftshift(double[] data,
boolean bComplex,
boolean bSign)
shift zero frequency to center, or vice verse, 1D.
|
static float[][] |
fftshift(float[][] data,
boolean bComplex,
boolean bSign)
shift zero frequency to center, or vice verse, 2D.
|
static float[] |
fftshift(float[] data,
boolean bComplex,
boolean bSign)
shift zero frequency to center, or vice verse, 1D.
|
static void |
GetLowandHighPassImage(float[][] data,
float[][] LowPassFilter,
float[][] HighPassFilter,
float[][] LowPassImage,
float[][] HighPassImage)
Get Lowpass and HighPass Images for "real" image using "real" filters
|
static int |
getNextPowerOfTwo(int value)
Returns the NEXT power of 2 given a certain integer value
For power of twos it also returns the next power of 2, e.g.
|
static Grid2D |
getPowerSpectrum(Grid2D imp)
Returns the 2D power spectrum of a given image processor.
|
static double[] |
hilbertKernel(int width) |
static double[] |
hilbertTransform(double[] array,
int nTimes)
Computes the 1-D Hilbert Transform of the given Array.
|
static void |
init1DFFT(int width) |
static double[] |
invertRampFilter(double[] filter,
double max)
Estimates an inverse of a Ramp Filter.
|
static boolean |
isPowerOfTwo(int value)
Returns true if the number is a power of two
|
static double[] |
lowPassFilterRealDoubleArray(double[] array,
int cutOffIndex)
low pass filters the given array.
|
static double[] |
multiplyAbsolute(double[] one,
double[] two)
Multiplies two arrays of complex numbers.
|
static double[] |
multiplyComplex(double[] one,
double[] two)
Multiplies two arrays of complex numbers pairwise
|
static double[] |
multiplyComplex(double realOne,
double imagOne,
double realTwo,
double imagTwo)
Multiplies two complex values
|
static void |
printAbsolute(double[] array)
Prints the absolute values in the given array
|
static void |
printComplex(double[] array)
Prints the complex values in the given array.
|
static Grid2D |
removeRampFilter(Grid2D imp,
RampFilter ramp,
double max)
Removes a ramp filter from the ImageProcessor.
|
static void |
timesComplexNumber(double[] array,
double realOne,
double imagOne)
Multiplies the array with the complex number defined as two double values;
|
public static void init1DFFT(int width)
public static double[] fft(double[] array)
public static double[] fft(double[] array, int padding)
public static double[] complexSignum(double[] array)
array
- the arraypublic static double[] cSignum(double[] array)
array
- the arraypublic static void timesComplexNumber(double[] array, double realOne, double imagOne)
array
- the arrayrealOne
- the real part of the complex numberimagOne
- the imaginary part of the complex numberpublic static double[] complexOneOverPiT(int width)
public static double[] hilbertKernel(int width)
public static double[] hilbertTransform(double[] array, int nTimes)
array
- the arraynTimes
- the size of the zero padding:n = 1 zero pad to next power of 2 n = 2 zero pad to 2 times the next power of 2
public static double[] discreteHilbertTransform(double[] array, int nTimes)
public static double[] exactFiniteHilbertTransform(double[] array, int nTimes)
array
- the ArraynTimes
- Approximation for infinitypublic static double[] invertRampFilter(double[] filter, double max)
filter
- the filtermax
- the maximal scaling (1.0 is a good number)public static Grid2D removeRampFilter(Grid2D imp, RampFilter ramp, double max)
imp
- the filtered ImageProcessorramp
- the rampmax
- the maximum for the inverted ramp filter. (try 1.0)public static double[] lowPassFilterRealDoubleArray(double[] array, int cutOffIndex)
array
- the real double arraycutOffIndex
- the index to start cuttingpublic static Grid2D applyRampFilter_ECC(Grid2D imp, RampFilter ramp)
imp
- the ImageProcessor to be filteredramp
- the ramppublic static Grid2D applyRampFilter(Grid2D imp, RampFilter ramp)
imp
- the ImageProcessor to be filteredramp
- the ramppublic static double[] applyRampFilter(double[] detectorRow, RampFilter ramp)
detectorRow
- the rowramp
- the ramppublic static Grid2D apply2DFilter(Grid2D imp, Grid2D filter)
imp
- the ImageProcessor to be filteredfilter
- the filterpublic static double[] divideComplex(double realOne, double imagOne, double realTwo, double imagTwo)
realOne
- real part oneimagOne
- imaginary part onerealTwo
- real part twoimagTwo
- imaginary part twopublic static double[] divideAbsolute(double[] one, double[] two)
one
- the first arraytwo
- the second arraypublic static double[] multiplyComplex(double realOne, double imagOne, double realTwo, double imagTwo)
realOne
- real part oneimagOne
- imaginary part onerealTwo
- real part twoimagTwo
- imaginary part twopublic static double[] multiplyComplex(double[] one, double[] two)
one
- the first arraytwo
- the second arraypublic static double[] multiplyAbsolute(double[] one, double[] two)
one
- the first arraytwo
- the second arraypublic static double[] fftshift(double[] data, boolean bComplex, boolean bSign)
data
- the double data to be shiftedbComplex
- true: complex; false: realbSign
- true: fftshift; false: ifftshiftpublic static float[] fftshift(float[] data, boolean bComplex, boolean bSign)
data
- the float data to be shiftedbComplex
- true: complex; false: realbSign
- true: fftshift; false: ifftshiftpublic static double[][] fftshift(double[][] data, boolean bComplex, boolean bSign)
data
- the double data to be shiftedbComplex
- true: complex; false: realbSign
- true: fftshift; false: ifftshiftpublic static float[][] fftshift(float[][] data, boolean bComplex, boolean bSign)
data
- the double data to be shiftedbComplex
- true: complex; false: realbSign
- true: fftshift; false: ifftshiftpublic static void GetLowandHighPassImage(float[][] data, float[][] LowPassFilter, float[][] HighPassFilter, float[][] LowPassImage, float[][] HighPassImage)
data
- image in realLowPassFilter
- Low pass filter in realHighPassFilter
- High pass filter in realLowPassImage
- Low pass image in realHighPassImage
- High Pass image in realpublic static Grid2D getPowerSpectrum(Grid2D imp)
imp
- the ImageProcessorpublic static boolean isPowerOfTwo(int value)
value
- the input number.public static int getNextPowerOfTwo(int value)
value
- the input number.public static Grid2D estimateFilter2D(Grid2D before, Grid2D after, double threshold) throws java.lang.Exception
before
- the input imageafter
- the output imagethreshold
- the maximal value which may appear in the estimate. (to avoid outliers.)java.lang.Exception
- may occur.public static double[] estimateFilter(Grid2D after, Grid2D before, double threshold, boolean meanSquare) throws java.lang.Exception
after
- the output imagebefore
- the input imagejava.lang.Exception
- may occur.public static double abs(int pos, double[] array)
pos
- the positionarray
- the array which contains the valuespublic static double abs(int posx, int posy, double[][] array)
posx
- x positionposy
- y positionarray
- the arraypublic static void printAbsolute(double[] array)
array
- the array of complex valuespublic static void printComplex(double[] array)
array
- the array