public class MultiSpectral<T extends ImageSingleBand> extends ImageMultiBand<MultiSpectral<T>>
An image class for images with multiple bands/colors where each band is stored as an independent
ImageSingleBand. MultiSpectral image fully supports all functions inside of
ImageBase. Each internal image has the same width, height, startIndex, and stride.
For example, in a RGB image there would be three bands one for each color,
and each color would be stored in its own gray scale image. To access the image for a particular
band call getBand(int). To get the RGB value for a pixel (x,y) one would need to:
int red = image.get(0).get(x,y); int green = image.get(1).get(x,y); int blue = image.get(2).get(x,y);Setting the RGB value of pixel (x,y) is done in a similar manor:
image.get(0).get(x,y,red); image.get(1).get(x,y,green); image.get(2).get(x,y,blue);
May image processing operations can be run independently on each color band. This is useful since many
operations have been written for ImageSingleBand, but not MultiSpectral yet.
for( int i = 0; i < image.numBands(); i++ ) {
SomeGrayImageFilter.process( image.getBand(0) );
}
| Modifier and Type | Field and Description |
|---|---|
T[] |
bands
Set of gray scale images
|
java.lang.Class<T> |
type
Type of image in each band
|
| Constructor and Description |
|---|
MultiSpectral(java.lang.Class<T> type,
int numBands)
Declares internal arrays for storing each band, but not the images in each band.
|
MultiSpectral(java.lang.Class<T> type,
int width,
int height,
int numBands)
Creates a MultiSpectral image with the specified properties.
|
| Modifier and Type | Method and Description |
|---|---|
MultiSpectral<T> |
_createNew(int imgWidth,
int imgHeight)
Creates a new image of the same type and number of bands
|
T |
getBand(int band)
Returns a band in the multi-band image.
|
T[] |
getBands() |
java.lang.Class<T> |
getBandType()
Type of image each band is stored as.
|
int |
getNumBands()
Returns the number of bands or colors stored in this image.
|
MultiSpectral<T> |
partialSpectrum(int... which)
Returns a new
MultiSpectral which references the same internal single band images at this one. |
void |
reshape(int width,
int height)
Changes the image's width and height without declaring new memory.
|
void |
setBand(int which,
T image) |
void |
setBands(T[] bands) |
void |
setBandType(java.lang.Class<T> type) |
void |
setTo(MultiSpectral<T> orig)
Sets the values of each pixel equal to the pixels in the specified matrix.
|
MultiSpectral<T> |
subimage(int x0,
int y0,
int x1,
int y1,
MultiSpectral<T> subimage)
Creates a sub-image from 'this' image.
|
clone, createSameShape, getHeight, getImageType, getIndex, getStartIndex, getStride, getWidth, indexToPixel, isInBounds, isSubimage, setHeight, setStartIndex, setStride, setWidth, subimagepublic java.lang.Class<T extends ImageSingleBand> type
public T extends ImageSingleBand[] bands
public MultiSpectral(java.lang.Class<T> type, int width, int height, int numBands)
type - The type of image which each band is stored as.width - Width of the image.height - Height of the image.numBands - Total number of bands.public MultiSpectral(java.lang.Class<T> type, int numBands)
type - The type of image which each band is stored as.numBands - Number of bands in the image.public java.lang.Class<T> getBandType()
public int getNumBands()
getNumBands in class ImageMultiBand<MultiSpectral<T extends ImageSingleBand>>public T getBand(int band)
band - Which band should be returned.public MultiSpectral<T> subimage(int x0, int y0, int x1, int y1, MultiSpectral<T> subimage)
subimage in class ImageBase<MultiSpectral<T extends ImageSingleBand>>x0 - x-coordinate of top-left corner of the sub-image.y0 - y-coordinate of top-left corner of the sub-image.x1 - x-coordinate of bottom-right corner of the sub-image.y1 - y-coordinate of bottom-right corner of the sub-image.subimage - public void setTo(MultiSpectral<T> orig)
setTo in class ImageBase<MultiSpectral<T extends ImageSingleBand>>orig - The original image whose value is to be copied into this onepublic void reshape(int width,
int height)
reshape in class ImageBase<MultiSpectral<T extends ImageSingleBand>>width - The new width.height - The new height.public MultiSpectral<T> _createNew(int imgWidth, int imgHeight)
_createNew in class ImageBase<MultiSpectral<T extends ImageSingleBand>>imgWidth - image widthimgHeight - image heightpublic MultiSpectral<T> partialSpectrum(int... which)
MultiSpectral which references the same internal single band images at this one.which - List of bands which will comprise the new imagepublic void setBandType(java.lang.Class<T> type)
public T[] getBands()
public void setBands(T[] bands)
public void setBand(int which,
T image)