Paul
Paul

Reputation: 153

Is it possible to run exponent on raster bands in GeoTools?

Since I've not been able to store a contrast enhanced GridReaderLayer to to a TIFF file, I was thinking of if I could do what GDAL does here:

gdal_translate -scale 1 255 1 255 -exponent_1 0.5 -exponent_2 0.4 -exponent_3 0.5 C:\Temp\34SDG.tif C:\Temp\34sdg_edited.tif

in GeoTools.

Instead of the contrast enhancement I'm doing to day:

    SelectedChannelType[] sct = new SelectedChannelType[gridCoverage2D.getNumSampleDimensions()];
    ContrastEnhancement ce1 = styleFactory.contrastEnhancement(filterFactory2.literal(red), ContrastMethod.NORMALIZE);
    sct[0] = styleFactory.createSelectedChannelType(String.valueOf(channelNum[0]), ce1);
    ContrastEnhancement ce2 = styleFactory.contrastEnhancement(filterFactory2.literal(green), ContrastMethod.NORMALIZE);
    sct[1] = styleFactory.createSelectedChannelType(String.valueOf(channelNum[1]), ce2);
    ContrastEnhancement ce3 = styleFactory.contrastEnhancement(filterFactory2.literal(blue), ContrastMethod.NORMALIZE);
    sct[2] = styleFactory.createSelectedChannelType(String.valueOf(channelNum[2]), ce3);
    RasterSymbolizer sym = styleFactory.getDefaultRasterSymbolizer();
    ChannelSelection sel = styleFactory.channelSelection(sct[RED], sct[GREEN], sct[BLUE]);
    sym.setChannelSelection(sel);
    return SLD.wrapSymbolizers(sym);

Then I could modify the GridReaderLayer with exponent values, in my viewer, until I'm satisfied and then run gdal_translate with the exponent values on the original TIFF file to a new edited TIFF file.

Upvotes: 0

Views: 22

Answers (0)

Related Questions