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

Class ImageBase<T extends ImageBase>

  • All Implemented Interfaces:
    java.io.Serializable, java.lang.Cloneable
    Direct Known Subclasses:
    ImageGray, ImageMultiBand


    public abstract class ImageBase<T extends ImageBase>
    extends java.lang.Object
    implements java.io.Serializable, java.lang.Cloneable
    Base class for all image types.
    See Also:
    Serialized Form
    • Field Summary

      Fields 
      Modifier and Type Field and Description
      int height
      Number of rows in the image.
      ImageType<T> imageType
      Description of the image data structure
      int startIndex
      Index of the first pixel in the data array
      int stride
      How many elements need to be skipped over to go one row down.
      boolean subImage
      Indicates if it is a sub-image or not
      int width
      Number of columns in the image.
    • Constructor Summary

      Constructors 
      Constructor and Description
      ImageBase() 
    • Field Detail

      • startIndex

        public int startIndex
        Index of the first pixel in the data array
      • stride

        public int stride
        How many elements need to be skipped over to go one row down.
      • width

        public int width
        Number of columns in the image.
      • height

        public int height
        Number of rows in the image.
      • subImage

        public boolean subImage
        Indicates if it is a sub-image or not
      • imageType

        public ImageType<T extends ImageBase> imageType
        Description of the image data structure
    • Constructor Detail

      • ImageBase

        public ImageBase()
    • Method Detail

      • subimage

        public abstract T subimage(int x0,
                                   int y0,
                                   int x1,
                                   int y1,
                                   T subimage)

        Creates a rectangular sub-image from 'this' image. The subimage will share the same internal array that stores each pixel's value. Any changes to pixel values in the original image or the sub-image will affect the other. A sub-image must be a sub-set of the original image and cannot specify a bounds larger than the original.

        When specifying the sub-image, the top-left corner is inclusive and the bottom right corner exclusive. Thus, a sub-image will contain all the original pixels if the following is used: subimage(0,0,width,height,null).

        Parameters:
        x0 - x-coordinate of top-left corner of the sub-image, inclusive.
        y0 - y-coordinate of top-left corner of the sub-image, inclusive.
        x1 - x-coordinate of bottom-right corner of the sub-image, exclusive.
        y1 - y-coordinate of bottom-right corner of the sub-image, exclusive.
        subimage - Optional output for sub-image. If not null the subimage will be written into this image.
        Returns:
        A sub-image of 'this' image.
      • subimage

        public T subimage(int x0,
                          int y0,
                          int x1,
                          int y1)
        Same as subimage(int, int, int, int, ImageBase), but sets the storage for the input subimage to null.
        Parameters:
        x0 - x-coordinate of top-left corner of the sub-image, inclusive.
        y0 - y-coordinate of top-left corner of the sub-image, inclusive.
        x1 - x-coordinate of bottom-right corner of the sub-image, exclusive.
        y1 - y-coordinate of bottom-right corner of the sub-image, exclusive.
        Returns:
        A sub-image of 'this' image.
      • reshape

        public abstract void reshape(int width,
                                     int height)
        Changes the width and height of the image. If the image data array isn't large enough to hold an image of this size then a new array is declared. Otherwise the image data array is left unchanged and only the width and height variables are modified.
        Parameters:
        width - Desired image width
        height - Desired image height
      • setTo

        public abstract void setTo(T orig)
        Sets the value of 'this' image to be identical to the passed in image. All structural attributes of the images must be the same.
        Parameters:
        orig - Image for which 'this' is to be a copy of.
      • isSubimage

        public boolean isSubimage()
        If this matrix is a sub-image or not.
        Returns:
        true if it is a subimage, otherwise false.
      • isInBounds

        public final boolean isInBounds(int x,
                                        int y)
        Returns true if the pixel coordinate is inside the image or false if not.
        Parameters:
        x - pixel location x-axis
        y - pixel location y-axis
        Returns:
        true if inside and false if outside
      • getIndex

        public int getIndex(int x,
                            int y)
      • getWidth

        public final int getWidth()
      • setWidth

        public final void setWidth(int width)
      • getHeight

        public final int getHeight()
      • setHeight

        public final void setHeight(int height)
      • getStartIndex

        public int getStartIndex()
      • setStartIndex

        public void setStartIndex(int startIndex)
      • getStride

        public int getStride()
      • setStride

        public void setStride(int stride)
      • indexToPixel

        public Point2D_I32 indexToPixel(int index)
      • _createNew

        public abstract T _createNew(int imgWidth,
                                     int imgHeight)
        Returns a new image. If either width or height are set to -1 then none of the class parameters set. Otherwise a new image is created with the specified dimensions which has all other parameters the same as the original matrix.
        Parameters:
        imgWidth - Width of the new image
        imgHeight - height of the new image
        Returns:
        new image
      • getImageType

        public ImageType<T> getImageType()
        Description of the image data structure
        Returns:
        Description of the image data structure
      • createSameShape

        public T createSameShape()
        Creates a new image of the same type which also has the same shape. This is the same as calling _createNew(int, int) with this image's width and height.
        Returns:
        new image with the same shape as this.
      • clone

        public T clone()
        Creates an identical image. Note that if this image is a sub-image portions of hte image which are not part of the sub-image are not copied.
        Overrides:
        clone in class java.lang.Object
        Returns:
        Clone of this image.

DataMelt 3.0 © DataMelt by jWork.ORG

Ads help maintain this website.