Package boofcv.struct.image
Class ImageInterleaved<T extends ImageInterleaved<T>>
java.lang.Object
boofcv.struct.image.ImageBase<T>
boofcv.struct.image.ImageMultiBand<T>
boofcv.struct.image.ImageInterleaved<T>
- All Implemented Interfaces:
Serializable
,Cloneable
- Direct Known Subclasses:
InterleavedF32
,InterleavedF64
,InterleavedInteger
,InterleavedS64
Base class for images that contain multiple interleaved bands. Typically each band represents a different color or frequency of light detected in the imaging sensor.
Each pixel is composed of N bands. In an RGB image each pixel would be composed of 3 elements, [red][green][blue].
The index of the green band at pixel (3,10) would be:
index of green at (3,10) = startIndex + 10*stride + 3*numBands + 1
- See Also:
-
Nested Class Summary
Nested classes/interfaces inherited from class boofcv.struct.image.ImageBase
ImageBase.PixelXY
-
Field Summary
-
Constructor Summary
ModifierConstructorDescriptionprotected
protected
ImageInterleaved
(int width, int height, int numBands) Creates a new image with all of its parameters initialized, including the data array. -
Method Summary
Modifier and TypeMethodDescriptionprotected abstract Object
_getData()
Returns the data array the image is stored in.protected abstract void
Sets the image's internal data array.void
Copies the row into the array.static <B extends ImageInterleaved<B>>
B<B extends ImageInterleaved<B>>
BcreateSameShape
(Class<B> type) Creates an interleaved image of the specified type that will have the same shapeabstract ImageDataType
Returns image type informationint
getIndex
(int x, int y) int
getIndex
(int x, int y, int band) int
Returns the number of bands or colors stored in this image.protected abstract Class
void
reshape
(int width, int height) Changes the width and height of the image.void
reshape
(int width, int height, int numberOfBands) Reshape for MultiBand images which allows the number of bands to be changed a the same time toofinal void
setNumberOfBands
(int numBands) Changes the number of bands in the image while keeping the width and height the same.Sets this image equal to the specified image.Creates a sub-image from 'this' image.toString()
abstract String
toString_element
(int index) Convert an individual data element into a stringMethods inherited from class boofcv.struct.image.ImageMultiBand
reshapeTo
Methods inherited from class boofcv.struct.image.ImageBase
clone, copyCol, createNew, createSameShape, forEachXY, getImageType, indexToPixelX, indexToPixelY, isInBounds, isSameShape, isSubimage, subimage, totalPixels
-
Field Details
-
numBands
public int numBandsHow many color bands are contained in each pixel
-
-
Constructor Details
-
ImageInterleaved
protected ImageInterleaved(int width, int height, int numBands) Creates a new image with all of its parameters initialized, including the data array.- Parameters:
width
- Image's width.height
- Image's height.numBands
- Number of bands/colors.
-
ImageInterleaved
protected ImageInterleaved()
-
-
Method Details
-
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 classImageBase<T extends ImageInterleaved<T>>
- 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
- Optional storage for the subimage. Nullable.- Returns:
- A sub-image of this image.
-
reshape
public void reshape(int width, int height) Description copied from class:ImageBase
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.- Specified by:
reshape
in classImageBase<T extends ImageInterleaved<T>>
- Parameters:
width
- Desired image widthheight
- Desired image height
-
reshape
public void reshape(int width, int height, int numberOfBands) Description copied from class:ImageMultiBand
Reshape for MultiBand images which allows the number of bands to be changed a the same time too- Overrides:
reshape
in classImageMultiBand<T extends ImageInterleaved<T>>
- Parameters:
width
- Desired image widthheight
- Desired image heightnumberOfBands
- Desired number of bands
-
getIndex
public int getIndex(int x, int y) - Overrides:
getIndex
in classImageBase<T extends ImageInterleaved<T>>
-
getIndex
public int getIndex(int x, int y, int band) -
setTo
Sets this image equal to the specified image. Automatically resized to match the input image.- Specified by:
setTo
in classImageBase<T extends ImageInterleaved<T>>
- Parameters:
orig
- The original image whose value is to be copied into this one- Returns:
- Instance of 'this' to allow chaining.
-
getNumBands
public int getNumBands()Description copied from class:ImageMultiBand
Returns the number of bands or colors stored in this image.- Specified by:
getNumBands
in classImageMultiBand<T extends ImageInterleaved<T>>
- Returns:
- Number of bands in the image.
-
setNumberOfBands
public final void setNumberOfBands(int numBands) Description copied from class:ImageMultiBand
Changes the number of bands in the image while keeping the width and height the same. A simple reshape is done if possible, if not then new internal data is defined- Specified by:
setNumberOfBands
in classImageMultiBand<T extends ImageInterleaved<T>>
- Parameters:
numBands
- number of bands
-
getDataType
Returns image type information- Returns:
- The type of image.
-
_getData
Returns the data array the image is stored in.- Returns:
- data array;
-
getPrimitiveDataType
-
_setData
Sets the image's internal data array.- Parameters:
data
- data array
-
createSameShape
Creates an interleaved image of the specified type that will have the same shape -
create
public static <B extends ImageInterleaved<B>> B create(Class<B> type, int width, int height, int numBands) -
copyRow
Description copied from class:ImageBase
Copies the row into the array.- Specified by:
copyRow
in classImageBase<T extends ImageInterleaved<T>>
- Parameters:
row
- Which row to copy.col0
- First column. Inclusive.col1
- Last column. Exclusive.offset
- First index in output arrayarray
- Output array
-
toString
-
toString_element
Convert an individual data element into a string
-