Documentation of 'boofcv.struct.image.Planar' Java class
Planar
boofcv.struct.image

Class Planar<T extends ImageGray>

  • 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 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) );
     }    
     

    See Also:
    Serialized Form
    • Field Detail

      • type

        public java.lang.Class<T extends ImageGray> type
        Type of image in each band
      • bands

        public T extends ImageGray[] bands
        Set of gray scale images
    • 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:
        getNumBands in class ImageMultiBand<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:
        subimage in class ImageBase<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.
        Specified by:
        setTo in class ImageBase<Planar<T extends ImageGray>>
        Parameters:
        orig - The original image whose value is to be copied into this one
      • 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.
        Specified by:
        reshape in class ImageBase<Planar<T extends ImageGray>>
        Parameters:
        width - The new width.
        height - The new height.
      • _createNew

        public Planar<T> _createNew(int imgWidth,
                                    int imgHeight)
        Creates a new image of the same type and number of bands
        Specified by:
        _createNew in class ImageBase<Planar<T extends ImageGray>>
        Parameters:
        imgWidth - image width
        imgHeight - image height
        Returns:
        new image
      • partialSpectrum

        public Planar<T> partialSpectrum(int... which)
        Returns a new Planar which 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

Ads help maintain this website.