示例#1
0
  @Override
  public void initialize() throws OperatorException {
    final Band blueBand = sourceProduct.getBand(Landsat8Constants.LANDSAT8_BLUE_BAND_NAME);
    final Band cirrusBand = sourceProduct.getBand(Landsat8Constants.LANDSAT8_CIRRUS_BAND_NAME);
    final Band aerosolBand =
        sourceProduct.getBand(Landsat8Constants.LANDSAT8_COASTAL_AEROSOL_BAND_NAME);
    final Band panBand = sourceProduct.getBand(Landsat8Constants.LANDSAT8_PANCHROMATIC_BAND_NAME);

    // MPa: try with clost band:
    // get clost image: blue * aerosol * pan * cirrus
    RenderedImage blueImage = blueBand.getGeophysicalImage();
    RenderedImage aerosolImage = aerosolBand.getGeophysicalImage();
    RenderedOp blueAerosolImage = MultiplyDescriptor.create(blueImage, aerosolImage, null);
    RenderedImage panImage = panBand.getGeophysicalImage();
    RenderedOp blueAerosolPanImage = MultiplyDescriptor.create(blueAerosolImage, panImage, null);
    RenderedImage cirrusImage = cirrusBand.getGeophysicalImage();
    RenderedOp blueAerosolPanCirrusImage =
        MultiplyDescriptor.create(blueAerosolPanImage, cirrusImage, null);

    final Product clostProduct = createClostProduct(blueAerosolPanCirrusImage);
    setTargetProduct(clostProduct);
  }
示例#2
0
  public static void main(String[] args) {
    String sourceFile = args[0];
    int m = Integer.parseInt(args[1]);

    String format = sourceFile.substring(1 + sourceFile.lastIndexOf('.'));
    String targetBase = sourceFile.substring(0, sourceFile.lastIndexOf('.'));
    String targetFile0 = targetBase + "_" + m + "_0." + format;
    String targetFile1 = targetBase + "_" + m + "_1." + format;
    String targetFile2 = targetBase + "_" + m + "_2." + format;

    KernelJAI gaussKernel = createGaussianKernel(m);
    dumpKernelData("Gaussian", gaussKernel);
    KernelJAI distKernel = createDistancesKernel(m);
    dumpKernelData("Distances", distKernel);

    RenderedOp source = FileLoadDescriptor.create(sourceFile, null, true, null);
    source = BandSelectDescriptor.create(source, new int[1], null);
    System.out.println("Writing " + targetFile0);
    FileStoreDescriptor.create(source, targetFile0, format, null, false, null);

    long t1 = System.currentTimeMillis();
    System.out.println("Computing " + targetFile1);
    BorderExtender borderExtender = BorderExtender.createInstance(BorderExtender.BORDER_COPY);
    RenderedOp target1 =
        ConvolveDescriptor.create(
            source, gaussKernel, new RenderingHints(JAI.KEY_BORDER_EXTENDER, borderExtender));
    RenderedOp mask = ClampDescriptor.create(source, new double[] {0}, new double[] {1}, null);
    mask = MultiplyConstDescriptor.create(mask, new double[] {255}, null);
    mask = NotDescriptor.create(mask, null);
    mask = ClampDescriptor.create(mask, new double[] {0}, new double[] {1}, null);
    target1 = MultiplyDescriptor.create(target1, mask, null);
    target1 = AddDescriptor.create(target1, source, null);
    System.out.println("Writing " + targetFile1);
    FileStoreDescriptor.create(target1, targetFile1, format, null, false, null);
    System.out.println("Done in " + (System.currentTimeMillis() - t1) + " ms");

    long t2 = System.currentTimeMillis();
    System.out.println("Computing " + targetFile2);
    BufferedImage target2 = convolveICOL(source, gaussKernel, distKernel);
    System.out.println("Writing " + targetFile2);
    FileStoreDescriptor.create(target2, targetFile2, format, null, false, null);
    System.out.println("Done in " + (System.currentTimeMillis() - t2) + " ms");
  }