Class Planar<T extends ImageGray>
- java.lang.Object
-
- boofcv.struct.image.ImageBase<T>
-
- boofcv.struct.image.ImageMultiBand<Planar<T>>
-
- boofcv.struct.image.Planar<T>
-
- All Implemented Interfaces:
- java.io.Serializable, java.lang.Cloneable
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 ofImageBase. 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) ); }- See Also:
- Serialized Form
-
-
Field Summary
Fields Modifier and Type Field and Description T[]bandsSet of gray scale imagesjava.lang.Class<T>typeType of image in each band
-
Constructor Summary
Constructors 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.
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method and Description Planar<T>_createNew(int imgWidth, int imgHeight)Creates a new image of the same type and number of bandsTgetBand(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.intgetNumBands()Returns the number of bands or colors stored in this image.Planar<T>partialSpectrum(int... which)Returns a newPlanarwhich references the same internal single band images at this one.voidreshape(int width, int height)Changes the image's width and height without declaring new memory.voidsetBand(int which, T image)voidsetBands(T[] bands)voidsetBandType(java.lang.Class<T> type)voidsetTo(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.-
Methods inherited from class boofcv.struct.image.ImageBase
clone, createSameShape, getHeight, getImageType, getIndex, getStartIndex, getStride, getWidth, indexToPixel, isInBounds, isSubimage, setHeight, setStartIndex, setStride, setWidth, subimage
-
-
-
-
Constructor Detail
-
Planar
public Planar(java.lang.Class<T> type, int width, int height, int numBands)
Creates a Planar image with the specified properties.- Parameters:
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.
-
Planar
public Planar(java.lang.Class<T> type, int numBands)
Declares internal arrays for storing each band, but not the images in each band.- Parameters:
type- The type of image which each band is stored as.numBands- Number of bands in the image.
-
-
Method Detail
-
getBandType
public java.lang.Class<T> getBandType()
Type of image each band is stored as.- Returns:
- The type of ImageGray which each band is stored as.
-
getNumBands
public int getNumBands()
Returns the number of bands or colors stored in this image.- Specified by:
getNumBandsin classImageMultiBand<Planar<T extends ImageGray>>- Returns:
- Number of bands in the image.
-
getBand
public T getBand(int band)
Returns a band in the multi-band image.- Parameters:
band- Which band should be returned.- Returns:
- Image band
-
subimage
public Planar<T> subimage(int x0, int y0, int x1, int y1, Planar<T> subimage)
Creates a sub-image from 'this' image. The subimage will share the same internal array that stores each pixel's value, but will only pertain to an axis-aligned rectangular segment of the original.- Specified by:
subimagein classImageBase<Planar<T extends ImageGray>>- Parameters:
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-- Returns:
- A sub-image of this image.
-
setTo
public void setTo(Planar<T> orig)
Sets the values of each pixel equal to the pixels in the specified matrix. Automatically resized to match the input image.
-
reshape
public void reshape(int width, int height)Changes the image's width and height without declaring new memory. If the internal array is not large enough to store the new image an IllegalArgumentException is thrown.
-
_createNew
public Planar<T> _createNew(int imgWidth, int imgHeight)
Creates a new image of the same type and number of bands- Specified by:
_createNewin classImageBase<Planar<T extends ImageGray>>- Parameters:
imgWidth- image widthimgHeight- image height- Returns:
- new image
-
partialSpectrum
public Planar<T> partialSpectrum(int... which)
Returns a newPlanarwhich references the same internal single band images at this one.- Parameters:
which- List of bands which will comprise the new image- Returns:
- New image
-
setBandType
public void setBandType(java.lang.Class<T> type)
-
getBands
public T[] getBands()
-
setBands
public void setBands(T[] bands)
-
setBand
public void setBand(int which, T image)
-
-
DataMelt 3.0 © DataMelt by jWork.ORG