/** * Extract the actual data from prepared data. The output image must have * the same number of rows as the prepared data, and half the number of * columns. * * @param prepared * the prepared data * @param output * the output * @param centre * if true, then the data will be prepared so that the DC * component is centered. */ public static void unprepareData(float[] prepared, FImage output, boolean centre) { unprepareData(prepared, output.pixels, centre); }
/** * Extract the actual data from prepared data. The output image must have * the same number of rows as the prepared data, and half the number of * columns. * * @param prepared * the prepared data * @param output * the output * @param centre * if true, then the data will be prepared so that the DC * component is centered. */ public static void unprepareData(float[][] prepared, FImage output, boolean centre) { unprepareData(prepared, output.pixels, centre); }
/** * Extract the actual data from prepared data. The output image must have * the same number of rows as the prepared data, and half the number of * columns. * * @param prepared * the prepared data * @param output * the output * @param centre * if true, then the data will be prepared so that the DC * component is centered. */ public static void unprepareData(float[] prepared, FImage output, boolean centre) { unprepareData(prepared, output.pixels, centre); }
/** * Extract the actual data from prepared data. The output image must have * the same number of rows as the prepared data, and half the number of * columns. * * @param prepared * the prepared data * @param output * the output * @param centre * if true, then the data will be prepared so that the DC * component is centered. */ public static void unprepareData(float[][] prepared, FImage output, boolean centre) { unprepareData(prepared, output.pixels, centre); }
private FImage convolve(final int cols, final int rows, final float[][] preparedImage, final float[][] preparedFilter) { for (int y = 0; y < rows; y++) { for (int x = 0; x < cols; x++) { final float reImage = preparedImage[y][x * 2]; final float imImage = preparedImage[y][1 + x * 2]; final float reKernel = preparedFilter[y][x * 2]; final float imKernel = preparedFilter[y][1 + x * 2]; final float re = reImage * reKernel - imImage * imKernel; final float im = reImage * imKernel + imImage * reKernel; tmpImage[y][x * 2] = re; tmpImage[y][1 + x * 2] = im; } } fft.complexInverse(tmpImage, true); final FImage out = new FImage(cols, rows); FourierTransform.unprepareData(tmpImage, out, false); return out; }
private FImage convolve(final int cols, final int rows, final float[][] preparedImage, final float[][] preparedFilter) { for (int y = 0; y < rows; y++) { for (int x = 0; x < cols; x++) { final float reImage = preparedImage[y][x * 2]; final float imImage = preparedImage[y][1 + x * 2]; final float reKernel = preparedFilter[y][x * 2]; final float imKernel = preparedFilter[y][1 + x * 2]; final float re = reImage * reKernel - imImage * imKernel; final float im = reImage * imKernel + imImage * reKernel; tmpImage[y][x * 2] = re; tmpImage[y][1 + x * 2] = im; } } fft.complexInverse(tmpImage, true); final FImage out = new FImage(cols, rows); FourierTransform.unprepareData(tmpImage, out, false); return out; }
/** * Perform the inverse FFT using the underlying magnitude and phase images. * The resultant reconstructed image may need normalisation. * * @return the reconstructed image */ public FImage inverse() { final int cs = magnitude.getCols(); final int rs = magnitude.getRows(); final FloatFFT_2D fft = new FloatFFT_2D(rs, cs); final float[][] prepared = new float[rs][cs * 2]; for (int y = 0; y < rs; y++) { for (int x = 0; x < cs; x++) { final float p = phase.pixels[y][x]; final float m = magnitude.pixels[y][x]; final float re = (float) (m * Math.cos(p)); final float im = (float) (m * Math.sin(p)); prepared[y][x * 2] = re; prepared[y][1 + x * 2] = im; } } fft.complexInverse(prepared, true); final FImage image = new FImage(cs, rs); unprepareData(prepared, image, centre); return image; }
/** * Perform the inverse FFT using the underlying magnitude and phase images. * The resultant reconstructed image may need normalisation. * * @return the reconstructed image */ public FImage inverse() { final int cs = magnitude.getCols(); final int rs = magnitude.getRows(); final FloatFFT_2D fft = new FloatFFT_2D(rs, cs); final float[][] prepared = new float[rs][cs * 2]; for (int y = 0; y < rs; y++) { for (int x = 0; x < cs; x++) { final float p = phase.pixels[y][x]; final float m = magnitude.pixels[y][x]; final float re = (float) (m * Math.cos(p)); final float im = (float) (m * Math.sin(p)); prepared[y][x * 2] = re; prepared[y][1 + x * 2] = im; } } fft.complexInverse(prepared, true); final FImage image = new FImage(cs, rs); unprepareData(prepared, image, centre); return image; }
/** * Perform the inverse FFT using the underlying magnitude and phase images. * The resultant reconstructed image may need normalisation. * * @return the reconstructed image */ public FImage inverse() { final int cs = real.getCols(); final int rs = real.getRows(); final FloatFFT_2D fft = new FloatFFT_2D(rs, cs); final float[][] prepared = new float[rs][cs * 2]; for (int y = 0; y < rs; y++) { for (int x = 0; x < cs; x++) { prepared[y][x * 2] = real.pixels[y][x]; prepared[y][1 + x * 2] = imaginary.pixels[y][x]; } } fft.complexInverse(prepared, true); final FImage image = new FImage(cs, rs); FourierTransform.unprepareData(prepared, image, centre); return image; }
/** * Perform the inverse FFT using the underlying magnitude and phase images. * The resultant reconstructed image may need normalisation. * * @return the reconstructed image */ public FImage inverse() { final int cs = real.getCols(); final int rs = real.getRows(); final FloatFFT_2D fft = new FloatFFT_2D(rs, cs); final float[][] prepared = new float[rs][cs * 2]; for (int y = 0; y < rs; y++) { for (int x = 0; x < cs; x++) { prepared[y][x * 2] = real.pixels[y][x]; prepared[y][1 + x * 2] = imaginary.pixels[y][x]; } } fft.complexInverse(prepared, true); final FImage image = new FImage(cs, rs); FourierTransform.unprepareData(prepared, image, centre); return image; }
FourierTransform.unprepareData(preparedImage, out, centered); return out;
FourierTransform.unprepareData(preparedImage, out, centered); return out;
out = new FImage(cols, rows); FourierTransform.unprepareData(preparedImage, out, false);
out = new FImage(cols, rows); FourierTransform.unprepareData(preparedImage, out, false);
out = new FImage(cols, rows); FourierTransform.unprepareData(preparedImage, out, false);
out = new FImage(cols, rows); FourierTransform.unprepareData(preparedImage, out, false);
for (int i = 0; i < gaborFilters.length; i++) { G[i] = new FImage(this.gaborFilters[i].width / 2, this.gaborFilters[i].height); FourierTransform.unprepareData(gaborFilters[i].pixels, G[i], false); G[i] = ResizeProcessor.halfSize(G[i]); G[i].addInplace(G[i].clone().flipY().flipX());
for (int i = 0; i < gaborFilters.length; i++) { G[i] = new FImage(this.gaborFilters[i].width / 2, this.gaborFilters[i].height); FourierTransform.unprepareData(gaborFilters[i].pixels, G[i], false); G[i] = ResizeProcessor.halfSize(G[i]); G[i].addInplace(G[i].clone().flipY().flipX());
FourierTransform.unprepareData(data1, img1, false);
FourierTransform.unprepareData(data1, img1, false);