public final class TLcdPixelRescaleOp extends ALcdImageOperator
pixelRescale(in_value) {
normalized_in_value = normalize(in_value)
normalized_out_value = normalized_in_value * scale + offset
return denormalize(normalized_out_value)
}
The normalization range is defined by the ALcdBandSemantics
of the image.
When rescaling a pixel with a
"no data" value
, the
result is also "no data".
You can find more details about the image processing model here
.
// Using the static method:
ALcdImage inputImage = ...;
ALcdImage outputImage = TLcdPixelRescaleOp.pixelRescale(
inputImage,
new double[] { 1.0, 0.8, 0.2 },
new double[] { 0.07, 0.05, 0.0 }
);
// Using a data object:
ALcdImage inputImage = ...;
TLcdPixelRescaleOp op = new TLcdPixelRescaleOp();
ILcdDataObject params = op.getParameterDataType().newInstance();
params.setValue(TLcdPixelRescaleOp.INPUT_IMAGE, inputImage);
params.setValue(TLcdPixelRescaleOp.SCALES, new double[] { 1.0, 0.8, 0.2 });
params.setValue(TLcdPixelRescaleOp.OFFSETS, new double[] { 0.07, 0.05, 0.0 });
ALcdImage outputImage = op.apply(params);
ALcdImageOperator.ImageOperatorTypeBuilder
Modifier and Type | Field and Description |
---|---|
static TLcdDataProperty |
INPUT_IMAGE
The input image.
|
static String |
NAME
Name of the operator.
|
static TLcdDataProperty |
OFFSETS
The offset to apply to the scaled input image values.
|
static TLcdDataType |
PIXEL_RESCALE_FILTER_TYPE
Input data type of the operator.
|
static TLcdDataProperty |
SCALES
The scale to apply to the input image values.
|
INPUT_IMAGE_NAME
Constructor and Description |
---|
TLcdPixelRescaleOp()
Default constructor.
|
Modifier and Type | Method and Description |
---|---|
ALcdImage |
apply(ILcdDataObject aParameters)
Applies this operator to the given input parameters.
|
static ALcdImage |
pixelRescale(ALcdImage aSource,
double[] aScales,
double[] aOffsets)
Creates a pixel rescale operator for a given input image.
|
createTypeBuilder, createTypeBuilder, equals, getParameterDataType, hashCode, toString
public static final String NAME
public static final TLcdDataProperty INPUT_IMAGE
public static final TLcdDataProperty SCALES
public static final TLcdDataProperty OFFSETS
1.0 / 255.0
.public static final TLcdDataType PIXEL_RESCALE_FILTER_TYPE
public ALcdImage apply(ILcdDataObject aParameters)
ALcdImageOperator
apply
in class ALcdImageOperator
aParameters
- the parameters for the operatorpublic static ALcdImage pixelRescale(ALcdImage aSource, double[] aScales, double[] aOffsets)
aSource
- the image to be processedaScales
- the scales to applied to each of the image's color bandsaOffsets
- the offsets to be applied to each of the image's color bands