org.geotoolkit.image.jai
Class SilhouetteMask
Object
PlanarImage
OpImage
UntiledOpImage
SilhouetteMask
- All Implemented Interfaces:
- RenderedImage, ImageJAI, PropertyChangeEmitter, PropertySource, WritablePropertySource
public class SilhouetteMask
- extends UntiledOpImage
Creates the silhouette of an image that isolates its content from its background.
The background color is assumed to be uniform, with a know value which must be
specified as a parameter to this operation.
This operation can be used in order to build a mask for an image that has been rotated,
where pixels in the middle of the image should not have their value masked even if they
happen to have the same color than the background color.
Current implementation is rather simple and works for images in which the content
is inside a rotated rectangle. More complex outline are not guaranteed to work.
Example:
| Input | output |
|---|
 |
 |
Current algorithm
This operator starts from a corner of the source image. If the pixel value in that corner is
equals to the specified background color, then the corresponding sample value in the target
image is set to -1 (for integer data type, this is equivalent to setting all bits to 1).
Otherwise the target sample value is set to 0. If and only if the pixel in the corner has
been set to -1, then its neighbors pixels are examined iteratively in the same way. This
operation is repeated for the 4 image corners.
- Since:
- 3.00
- Version:
- 3.01
- Author:
- Martin Desruisseaux (Geomatys)
- Module:
| Fields inherited from class PlanarImage |
colorModel, eventManager, height, minX, minY, properties, sampleModel, tileFactory, tileGridXOffset, tileGridYOffset, tileHeight, tileWidth, width |
| Methods inherited from class OpImage |
addTileToCache, cancelTiles, computeRect, computeRect, computesUniqueTiles, createTile, dispose, getExpandedNumBands, getFormatTags, getOperationComputeType, getTile, getTileCache, getTileCacheMetric, getTileFromCache, getTileRecycler, getTiles, hasExtender, mapDestPoint, mapSourcePoint, prefetchTiles, queueTiles, recycleTile, setTileCache, vectorize, vectorize, vectorize |
| Methods inherited from class PlanarImage |
addPropertyChangeListener, addPropertyChangeListener, addSink, addSink, addSource, addTileComputationListener, copyData, copyData, copyExtendedData, createColorModel, createSnapshot, createWritableRaster, finalize, getAsBufferedImage, getAsBufferedImage, getBounds, getColorModel, getData, getData, getDefaultColorModel, getExtendedData, getGraphics, getHeight, getImageID, getMaxTileX, getMaxTileY, getMaxX, getMaxY, getMinTileX, getMinTileY, getMinX, getMinY, getNumBands, getNumSources, getNumXTiles, getNumYTiles, getProperties, getProperty, getPropertyClass, getPropertyNames, getPropertyNames, getSampleModel, getSinks, getSource, getSourceImage, getSourceObject, getSplits, getTileComputationListeners, getTileFactory, getTileGridXOffset, getTileGridYOffset, getTileHeight, getTileIndices, getTileRect, getTiles, getTileWidth, getWidth, overlapsMultipleTiles, removeProperty, removePropertyChangeListener, removePropertyChangeListener, removeSink, removeSink, removeSinks, removeSource, removeSources, removeTileComputationListener, setImageLayout, setProperties, setProperty, setSource, setSources, tileXToX, tileXToX, tileYToY, tileYToY, toString, wrapRenderedImage, XToTileX, XToTileX, YToTileY, YToTileY |
OPERATION_NAME
public static final String OPERATION_NAME
- The name of this operation in the JAI registry.
This is "org.geotoolkit.SilhouetteMask".
- See Also:
- Constant Field Values
SilhouetteMask
public SilhouetteMask(RenderedImage source,
ImageLayout layout,
Map<?,?> configuration,
double[]... background)
- Constructs a new silhouette mask for the given image. While this constructor is public,
it should usually not be invoked directly. You should use JAI
factory methods instead.
- Parameters:
source - The source image.layout - The image layout.configuration - The image properties and rendering hints.background - The background values in the source image.
getSources
public Vector<RenderedImage> getSources()
- Returns the source images.
- Specified by:
getSources in interface RenderedImage- Overrides:
getSources in class PlanarImage
computeImage
protected void computeImage(Raster[] sources,
WritableRaster dest,
Rectangle destRect)
- Computes a rectangle of outputs.
- Specified by:
computeImage in class UntiledOpImage
- Parameters:
sources - The source images. Should be an array of length 1.dest - The raster to be filled in.destRect - The region within the raster to be filled.
Copyright © 2009-2012 Geotoolkit.org. All Rights Reserved.