public class Planar<T extends ImageGray> extends ImageMultiBand<Planar<T>>
Multi-band image composed of discontinuous planar images for each band. The bands are discontinuous in that
each one is an independent memory and are of type ImageGray. Planar images 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 ImageGray, but not Planar 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 |
|---|
Planar(java.lang.Class<T> type,
int numBands)
Declares internal arrays for storing each band, but not the images in each band.
|
Planar(java.lang.Class<T> type,
int width,
int height,
int numBands)
Creates a Planar image with the specified properties.
|
| Modifier and Type | Method and Description |
|---|---|
Planar<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.
|
Planar<T> |
partialSpectrum(int... which)
Returns a new
Planar 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(Planar<T> orig)
Sets the values of each pixel equal to the pixels in the specified matrix.
|
Planar<T> |
subimage(int x0,
int y0,
int x1,
int y1,
Planar<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 Planar(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 Planar(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<Planar<T extends ImageGray>>public T getBand(int band)
band - Which band should be returned.public Planar<T> subimage(int x0, int y0, int x1, int y1, Planar<T> subimage)
subimage in class ImageBase<Planar<T extends ImageGray>>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(Planar<T> orig)
public void reshape(int width,
int height)
public Planar<T> _createNew(int imgWidth, int imgHeight)
_createNew in class ImageBase<Planar<T extends ImageGray>>imgWidth - image widthimgHeight - image heightpublic Planar<T> partialSpectrum(int... which)
Planar 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)