public final class TLcdMedianOp extends ALcdImageOperator
[3, 5, 2, 1, 4]
is
3
: 2 values are smaller ([1, 2]
) and 2 values are larger ([4, 5]
).
If one of the input pixels has a "no data" value
, the
result is also "no data".
This operator expects kernels with odd dimensions (e.g., 3x3). Otherwise an IllegalArgumentException
will be thrown.
// Using the static method:
ALcdImage inputImage = ...;
ALcdImage outputImage = TLcdMedianOp.median(inputImage, 3, 3);
// Using a data object:
ALcdImage inputImage = ...;
TLcdMedianOp op = new TLcdMedianOp();
ILcdDataObject params = op.getParameterDataType().newInstance();
params.setValue(TLcdMedianOp.INPUT_IMAGE, inputImage);
params.setValue(TLcdMedianOp.MASK_WIDTH, 3);
params.setValue(TLcdMedianOp.MASK_HEIGHT, 3);
outputImage = op.apply(params);
ALcdImageOperator.ImageOperatorTypeBuilder
Modifier and Type | Field and Description |
---|---|
static TLcdDataProperty |
INPUT_IMAGE
The input image.
|
static TLcdDataProperty |
MASK_HEIGHT
Height of the median filter.
|
static TLcdDataProperty |
MASK_WIDTH
Width of the median filter.
|
static TLcdDataType |
MEDIAN_FILTER_TYPE
Input data type of the operator.
|
static String |
NAME
Name of the operator.
|
INPUT_IMAGE_NAME
Constructor and Description |
---|
TLcdMedianOp()
Default constructor.
|
Modifier and Type | Method and Description |
---|---|
ALcdImage |
apply(ILcdDataObject aParameters)
Applies this operator to the given input parameters.
|
static ALcdImage |
median(ALcdImage aImage,
int aMaskWidth,
int aMaskHeight)
Applies a median filter to the given image.
|
createTypeBuilder, createTypeBuilder, equals, getParameterDataType, hashCode, toString
public static final String NAME
public static final TLcdDataProperty INPUT_IMAGE
public static final TLcdDataProperty MASK_WIDTH
public static final TLcdDataProperty MASK_HEIGHT
public static final TLcdDataType MEDIAN_FILTER_TYPE
public ALcdImage apply(ILcdDataObject aParameters)
ALcdImageOperator
apply
in class ALcdImageOperator
aParameters
- the parameters for the operator