If the operation to apply is know at compile time, then the easiest way to use this package is to use the {@link org.geotools.coverage.processing.Operations} convenience class. For example a {@linkplain org.opengis.coverage.grid.GridCoverage grid coverage} can be resampled to a different {@linkplain org.opengis.referencing.crs.CoordinateReferenceSystem coordinate reference system} using the following code:
Coverage reprojected = Operations.DEFAULT.{@linkplain org.geotools.coverage.processing.Operations#resample
resample}(myCoverage, newCRS);
If the operation to apply is unknow at compile time (for example because it is selected at runtime by the user in some widget), or if the operation is not listed in the {@code Operations} convenience class, then the generic way is to invoke the {@link org.geotools.coverage.processing.DefaultProcessor#doOperation doOperation} method on the {@linkplain org.geotools.coverage.processing.AbstractProcessor#getInstance default processor instance}. Available operations are listed in the {@linkplain org.geotools.coverage.processing.operation operation package}.
Computes each output sample by multiplying elements of a kernel with the samples surrounding a particular source sample.
Name: "Convolve"
JAI operator: "{@linkplain javax.media.jai.operator.ConvolveDescriptor Convolve}"
Parameters:
Name | Class | Default value | Minimum value | Maximum value |
---|---|---|---|---|
{@code "Source"} | {@link org.geotools.coverage.grid.GridCoverage2D} | N/A | N/A | N/A |
{@code "kernel"} | {@link javax.media.jai.KernelJAI} | N/A | N/A | N/A |
Perform a laplacian filter operation on a grid coverage.
This is a high pass filter which highlights the edges having positive and
negative brightness slopes. This filter mulitples the co-efficients in the
tabe below with the corresponding grid data value in the kernel window.
The new grid value will be calculated as the sum of
(grid value * co-efficient)
for each kernel cell divised by 9.
0 | -1 | 0 |
-1 | 4 | -1 |
0 | -1 | 0 |
Name: "LaplaceType1Filter"
JAI operator: "{@linkplain javax.media.jai.operator.ConvolveDescriptor Convolve}"
Parameters:
Name | Class | Default value | Minimum value | Maximum value |
---|---|---|---|---|
{@code "Source"} | {@link org.geotools.coverage.grid.GridCoverage2D} | N/A | N/A | N/A |
Perform a laplacian filter operation on a grid coverage.
This is a high pass filter which highlights the edges having positive and
negative brightness slopes. This filter mulitples the co-efficients in the
tabe below with the corresponding grid data value in the kernel window.
The new grid value will be calculated as the sum of
(grid value * co-efficient)
for each kernel cell divised by 9.
-1 | -1 | -1 |
-1 | 8 | -1 |
-1 | -1 | -1 |
Name: "LaplaceType1Filter"
JAI operator: "{@linkplain javax.media.jai.operator.ConvolveDescriptor Convolve}"
Parameters:
Name | Class | Default value | Minimum value | Maximum value |
---|---|---|---|---|
{@code "Source"} | {@link org.geotools.coverage.grid.GridCoverage2D} | N/A | N/A | N/A |
Non-linear filter which is useful for removing isolated lines or pixels while preserving the overall appearance of an image. The filter is implemented by moving a mask over the image. For each position of the mask, the center pixel is replaced by the max of the pixel values covered by the mask. There are several shapes possible for the mask, which are enumerated in the {@linkplain javax.media.jai.operator.MaxFilterDescriptor JAI documentation}.
Name: "MaxFilter"
JAI operator: "{@linkplain javax.media.jai.operator.MaxFilterDescriptor MaxFilter}"
Parameters:
Name | Class | Default value | Minimum value | Maximum value |
---|---|---|---|---|
{@code "Source"} | {@link org.geotools.coverage.grid.GridCoverage2D} | N/A | N/A | N/A |
{@code "Xsize"} | {@link java.lang.Integer} | 3 | 1 | N/A |
{@code "Ysize"} | {@link java.lang.Integer} | 3 | 1 | N/A |
{@code "maskShape"} | {@link javax.media.jai.operator.MaxFilterShape} | {@link javax.media.jai.operator.MaxFilterDescriptor#MAX_MASK_SQUARE} | N/A | N/A |
Note: In current implementation,
Xsize
and Ysize
must have the same value
(i.e. rectangular shapes are not supported).
Non-linear filter which is useful for removing isolated lines or pixels while preserving the overall appearance of an image. The filter is implemented by moving a mask over the image. For each position of the mask, the center pixel is replaced by the median of the pixel values covered by the mask. This filter results in a smoothing of the image values. There are several shapes possible for the mask, which are enumerated in the {@linkplain javax.media.jai.operator.MedianFilterDescriptor JAI documentation}.
Name: "MedianFilter"
JAI operator: "{@linkplain javax.media.jai.operator.MedianFilterDescriptor MedianFilter}"
Parameters:
Name | Class | Default value | Minimum value | Maximum value |
---|---|---|---|---|
{@code "Source"} | {@link org.geotools.coverage.grid.GridCoverage2D} | N/A | N/A | N/A |
{@code "Xsize"} | {@link java.lang.Integer} | 3 | 1 | N/A |
{@code "Ysize"} | {@link java.lang.Integer} | 3 | 1 | N/A |
{@code "maskShape"} | {@link javax.media.jai.operator.MedianFilterShape} | {@link javax.media.jai.operator.MedianFilterDescriptor#MEDIAN_MASK_SQUARE} | N/A | N/A |
Note: In current implementation,
Xsize
and Ysize
must have the same value
(i.e. rectangular shapes are not supported).
Non-linear filter which is useful for removing isolated lines or pixels while preserving the overall appearance of an image. The filter is implemented by moving a mask over the image. For each position of the mask, the center pixel is replaced by the min of the pixel values covered by the mask. There are several shapes possible for the mask, which are enumerated in the {@linkplain javax.media.jai.operator.MinFilterDescriptor JAI documentation}.
Name: "MinFilter"
JAI operator: "{@linkplain javax.media.jai.operator.MinFilterDescriptor MinFilter}"
Parameters:
Name | Class | Default value | Minimum value | Maximum value |
---|---|---|---|---|
{@code "Source"} | {@link org.geotools.coverage.grid.GridCoverage2D} | N/A | N/A | N/A |
{@code "Xsize"} | {@link java.lang.Integer} | 3 | 1 | N/A |
{@code "Ysize"} | {@link java.lang.Integer} | 3 | 1 | N/A |
{@code "maskShape"} | {@link javax.media.jai.operator.MinFilterShape} | {@link javax.media.jai.operator.MinFilterDescriptor#MIN_MASK_SQUARE} | N/A | N/A |
Note: In current implementation,
Xsize
and Ysize
must have the same value
(i.e. rectangular shapes are not supported).
Changes the colors associated to arbitrary
{@linkplain org.geotools.coverage.Category categories} in arbitrary bands.
The ColorMaps
arguments must be an array of {@link java.util.Map}s
with a minimal length of 1. The Map
in array element 0 is used
for band 0; the Map
in array element 1 is used for band 1, etc.
If there is more bands than array elements in ColorMaps
, then
the last Map
is reused for all remaining bands.
For each {@link java.util.Map} in ColorMaps
,
the keys are category names as {@link java.lang.String} and the values are
colors as an array of type {@linkplain java.awt.Color}[]
. All
categories with a name matching a key in the Map
will be
{@linkplain org.geotools.coverage.Category#recolor recolored} with the associated
colors. All categories with no corresponding entries in the Map
will be left unchanged. The null
key is a special value meaning
"any quantitative category". For example in order to repaint forest in
green, river in blue and lets other categories unchanged, one can write:
Map map = new HashMap(); map.put("Forest", new Color[]{Color.GREEN}); map.put("River", new Color[]{Color.BLUE }); Map[] colorMaps = new Map[] { map // Use for all bands }
Name: "Recolor"
JAI operator: N/A
Parameters:
Name | Class | Default value | Minimum value | Maximum value |
---|---|---|---|---|
{@code "Source"} | {@link org.geotools.coverage.grid.GridCoverage2D} | N/A | N/A | N/A |
{@code "ColorMaps"} | {@linkplain java.util.Map}[] |
A gray scale | N/A | N/A |
A gray scale threshold classifies the grid coverage values into a boolean value. The sample dimensions will be modified into a boolean value and the dimension type of the source sample dimension will be represented as 1 bit.
Name: "Threshold"
JAI operator: "{@linkplain javax.media.jai.operator.BinarizeDescriptor Binarize}"
Parameters:
Name | Class | Default value | Minimum value | Maximum value |
---|---|---|---|---|
{@code "Source"} | {@link org.geotools.coverage.grid.GridCoverage2D} | N/A | N/A | N/A |
{@code "threshold"} | {@code double[]} | N/A | N/A | N/A |