/** Performs an inverse 1D Fast Hartley Transform (FHT) of an array */ public void inverseTransform1D(float[] fht) { int n = fht.length; if (S==null || n!=maxN) { if (!isPowerOf2(n)) throw new IllegalArgumentException("Not power of 2 length: "+n); initializeTables(n); } dfht3(fht, 0, true, n); }
/** Performs an inverse 1D Fast Hartley Transform (FHT) of an array */ public void inverseTransform1D(float[] fht) { int n = fht.length; if (S==null || n!=maxN) { if (!isPowerOf2(n)) throw new IllegalArgumentException("Not power of 2 length: "+n); initializeTables(n); } dfht3(fht, 0, true, n); }
void transform(boolean inverse) { //IJ.log("transform: "+maxN+" "+inverse); if (!powerOf2Size()) throw new IllegalArgumentException("Image not power of 2 size or not square: "+width+"x"+height); maxN = width; if (S==null) initializeTables(maxN); float[] fht = (float[])getPixels(); rc2DFHT(fht, inverse, maxN); isFrequencyDomain = !inverse; }
/** Performs an optimized 1D Fast Hartley Transform (FHT) of an array. * Array size must be a power of 2. * Note that all amplitudes in the output 'x' are multiplied by the array length. * Therefore, to get the power spectrum, for 1 <=i < N/2, use * ps[i] = (x[i]*x[i]+x[maxN-i]*x[maxN-i])/(maxN*maxN), where maxN is the array length. * To get the real part of the complex FFT, for i=0 use x[0]/maxN, * and for i>0, use (x[i]+x[maxN-i])/(2*maxN). * The imaginary part of the complex FFT, with i>0, is given by (x[i]-x[maxN-i])/(2*maxN) * The coefficients of cosine and sine are like the real and imaginary values above, * but you have to divide by maxN instead of 2*maxN. */ public void transform1D(float[] x) { int n = x.length; if (S==null || n!=maxN) { if (!isPowerOf2(n)) throw new IllegalArgumentException("Not power of 2 length: "+n); initializeTables(n); } dfht3(x, 0, false, n); }
void transform(boolean inverse) { //IJ.log("transform: "+maxN+" "+inverse); if (!powerOf2Size()) throw new IllegalArgumentException("Image not power of 2 size or not square: "+width+"x"+height); maxN = width; if (S==null) initializeTables(maxN); float[] fht = (float[])getPixels(); rc2DFHT(fht, inverse, maxN); isFrequencyDomain = !inverse; }
/** Performs an optimized 1D Fast Hartley Transform (FHT) of an array. * Array size must be a power of 2. * Note that all amplitudes in the output 'x' are multiplied by the array length. * Therefore, to get the power spectrum, for 1 <=i < N/2, use * ps[i] = (x[i]*x[i]+x[maxN-i]*x[maxN-i])/(maxN*maxN), where maxN is the array length. * To get the real part of the complex FFT, for i=0 use x[0]/maxN, * and for i>0, use (x[i]+x[maxN-i])/(2*maxN). * The imaginary part of the complex FFT, with i>0, is given by (x[i]-x[maxN-i])/(2*maxN) * The coefficients of cosine and sine are like the real and imaginary values above, * but you have to divide by maxN instead of 2*maxN. */ public void transform1D(float[] x) { int n = x.length; if (S==null || n!=maxN) { if (!isPowerOf2(n)) throw new IllegalArgumentException("Not power of 2 length: "+n); initializeTables(n); } dfht3(x, 0, false, n); }
float rt1, rt2, rt3, rt4; if (S==null) initializeTables(maxN); Nlog2 = log2(maxN);
float rt1, rt2, rt3, rt4; if (S==null) initializeTables(maxN); Nlog2 = log2(maxN);
if (S==null) initializeTables(maxN); for (int row=0; row<maxN; row++) dfht3(x, row*maxN, inverse, maxN);
if (S==null) initializeTables(maxN); for (int row=0; row<maxN; row++) dfht3(x, row*maxN, inverse, maxN);