Esempio n. 1
0
  public void process(BufferedImage input) {
    setInputImage(input);

    image.reshape(input.getWidth(), input.getHeight());
    transform.reshape(input.getWidth(), input.getHeight());
    magnitude.reshape(input.getWidth(), input.getHeight());
    phase.reshape(input.getWidth(), input.getHeight());

    ConvertBufferedImage.convertFrom(input, image, true);
    fft.forward(image, transform);

    GDiscreteFourierTransformOps.shiftZeroFrequency(transform, true);

    GDiscreteFourierTransformOps.magnitude(transform, magnitude);
    GDiscreteFourierTransformOps.phase(transform, phase);

    // Convert it to a log scale for visibility
    GPixelMath.log(magnitude, magnitude);

    SwingUtilities.invokeLater(
        new Runnable() {
          public void run() {
            setPreferredSize(new Dimension(image.width + 50, image.height + 20));
            processedImage = true;
          }
        });

    doRefreshAll();
  }
Esempio n. 2
0
  public FourierVisualizeApp(ImageDataType imageType) {
    this.imageType = imageType;

    image = GeneralizedImageOps.createSingleBand(imageType, 1, 1);
    transform = GeneralizedImageOps.createInterleaved(imageType, 1, 1, 2);
    magnitude = GeneralizedImageOps.createSingleBand(imageType, 1, 1);
    phase = GeneralizedImageOps.createSingleBand(imageType, 1, 1);
    fft = GDiscreteFourierTransformOps.createTransform(imageType);

    setMainGUI(panel);
  }