/** * Prepare data for a input to the FFT, padding if necessary. * * @param input * input data * @param rs * desired number of rows * @param cs * desired number of columns * @param centre * if true, then the data will be prepared so that the DC * component is centred. * @return prepared data */ public static float[][] prepareData(FImage input, int rs, int cs, boolean centre) { return prepareData(input.pixels, rs, cs, 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); }
@Override public void analyseImage(FImage image) { final FourierTransform ft = new FourierTransform(image, false); final FImage mag = ft.getMagnitude(); int count = 0; for (int y = 0; y < mag.height; y++) { for (int x = 0; x < mag.width; x++) { if (Math.abs(mag.pixels[y][x]) > threshold) count++; } } bpp = (double) count / (double) (mag.height * mag.width); DisplayUtilities.display(image, "" + bpp); }
float[][] preparedImage = FourierTransform.prepareData(image.pixels, rows, cols, false); fft.complexForward(preparedImage); float[][] preparedKernel = FourierTransform.prepareData(template.pixels, rows, cols, false); fft.complexForward(preparedKernel); out = new FImage(cols, rows); FourierTransform.unprepareData(preparedImage, out, false);
/** * Construct Fourier Transform by performing a forward transform on the * given image. If the centre option is set, the FFT will be re-ordered so * that the DC component is in the centre. * * @param image * the image to transform * @param centre * should the FFT be reordered so the centre is DC component */ public FourierTransform(FImage image, boolean centre) { this.centre = centre; process(image); }
/** * Prepare data for a input to the FFT, padding if necessary. The data is * prepared as a packed 1D array. * * @param input * input data * @param rs * desired number of rows * @param cs * desired number of columns * @param centre * if true, then the data will be prepared so that the DC * component is centred. * @return prepared data */ public static float[] prepareData1d(FImage input, int rs, int cs, boolean centre) { return prepareData1d(input.pixels, rs, cs, centre); }
float[][] preparedImage = FourierTransform.prepareData(image.pixels, rows, cols, false); fft.complexForward(preparedImage); float[][] preparedKernel = FourierTransform.prepareData(template.pixels, rows, cols, false); fft.complexForward(preparedKernel); out = new FImage(cols, rows); FourierTransform.unprepareData(preparedImage, out, false);
/** * Construct Fourier Transform by performing a forward transform on the * given image. If the centre option is set, the FFT will be re-ordered so * that the DC component is in the centre. * * @param image * the image to transform * @param centre * should the FFT be reordered so the centre is DC component */ public FourierTransform(FImage image, boolean centre) { this.centre = centre; process(image); }
/** * Prepare data for a input to the FFT, padding if necessary. The data is * prepared as a packed 1D array. * * @param input * input data * @param rs * desired number of rows * @param cs * desired number of columns * @param centre * if true, then the data will be prepared so that the DC * component is centred. * @return prepared data */ public static float[] prepareData1d(FImage input, int rs, int cs, boolean centre) { return prepareData1d(input.pixels, rs, cs, centre); }
final float[][] preparedImage = FourierTransform.prepareData(image.pixels, rows, cols, false); fft.complexForward(preparedImage); final float[][] preparedKernel = FourierTransform.prepareData(kernel, rows, cols, false); fft.complexForward(preparedKernel); out = new FImage(cols, rows); FourierTransform.unprepareData(preparedImage, out, false);
/** * Prepare data for a input to the FFT, padding if necessary. * * @param input * input data * @param rs * desired number of rows * @param cs * desired number of columns * @param centre * if true, then the data will be prepared so that the DC * component is centred. * @return prepared data */ public static float[][] prepareData(FImage input, int rs, int cs, boolean centre) { return prepareData(input.pixels, rs, cs, 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); }
@Override public void analyseImage(FImage image) { final FourierTransform ft = new FourierTransform(image, false); final FImage mag = ft.getMagnitude(); int count = 0; for (int y = 0; y < mag.height; y++) { for (int x = 0; x < mag.width; x++) { if (Math.abs(mag.pixels[y][x]) > threshold) count++; } } bpp = (double) count / (double) (mag.height * mag.width); DisplayUtilities.display(image, "" + bpp); }
final float[][] preparedImage = FourierTransform.prepareData(image.pixels, rows, cols, false); fft.complexForward(preparedImage); final float[][] preparedKernel = FourierTransform.prepareData(kernel, rows, cols, false); fft.complexForward(preparedKernel); out = new FImage(cols, rows); FourierTransform.unprepareData(preparedImage, out, false);
final float[][][] data = new float[10][][]; for (int i = 0; i < windowSize; i++) data[i] = FourierTransform.prepareData(sequence[i], height, width, false); fft.complexForward(data);
/** * 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); }
final float[][] preparedImage = FourierTransform.prepareData(image.pixels, rows, cols, centered); fft.complexForward(preparedImage); FourierTransform.unprepareData(preparedImage, out, centered); return out;
final float[][][] data = new float[10][][]; for (int i = 0; i < windowSize; i++) data[i] = FourierTransform.prepareData(sequence[i], height, width, false); fft.complexForward(data);
/** * 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); }
FourierTransform.prepareData(image.pixels, rows, cols, centered); fft.complexForward(preparedImage); FourierTransform.unprepareData(preparedImage, out, centered); return out;