private void undoRadialDistortion(BufferedImage image) {
    ConvertBufferedImage.convertFromMulti(image, origMS, true, ImageFloat32.class);

    for (int i = 0; i < origMS.getNumBands(); i++) {
      ImageFloat32 in = origMS.getBand(i);
      ImageFloat32 out = correctedMS.getBand(i);

      undoRadial.apply(in, out);
    }
    if (correctedMS.getNumBands() == 3)
      ConvertBufferedImage.convertTo(correctedMS, undistorted, true);
    else if (correctedMS.getNumBands() == 1)
      ConvertBufferedImage.convertTo(correctedMS.getBand(0), undistorted);
    else throw new RuntimeException("What kind of image has " + correctedMS.getNumBands() + "???");
  }
Beispiel #2
0
  private void doNotScaleLayers() {
    int N = pyramid.getNumLayers();

    for (int i = 0; i < N; i++) {
      BufferedImage b = ConvertBufferedImage.convertTo(pyramid.getLayer(i), null, true);
      addImage(b, String.format("%5.2f", pyramid.getScale(i)));
    }
  }
Beispiel #3
0
  private void scaleUpLayers() {
    T l = pyramid.getLayer(0);
    if (upscale == null) {
      interp = (InterpolatePixelS<T>) FactoryInterpolation.nearestNeighborPixelS(l.getClass());
      upscale = (T) l._createNew(l.width, l.height);
    } else {
      upscale.reshape(l.width, l.height);
    }

    int N = pyramid.getNumLayers();

    for (int i = 0; i < N; i++) {
      new FDistort(pyramid.getLayer(i), upscale).interpNN().scaleExt().apply();
      BufferedImage b = ConvertBufferedImage.convertTo(upscale, null, true);
      if (showScales) addImage(b, String.format("%5.2f", pyramid.getScale(i)));
      else addImage(b, String.format("%5.2f", pyramid.getSigma(i)));
    }
  }