public abstract class ImageBase<T extends ImageBase>
extends java.lang.Object
implements java.io.Serializable, java.lang.Cloneable
| 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 and Description |
|---|
ImageBase() |
| Modifier and Type | Method and Description |
|---|---|
abstract T |
_createNew(int imgWidth,
int imgHeight)
Returns a new image.
|
T |
clone()
Creates an identical image.
|
T |
createSameShape()
Creates a new image of the same type which also has the same shape.
|
int |
getHeight() |
ImageType<T> |
getImageType()
Description of the image data structure
|
int |
getIndex(int x,
int y) |
int |
getStartIndex() |
int |
getStride() |
int |
getWidth() |
georegression.struct.point.Point2D_I32 |
indexToPixel(int index) |
boolean |
isInBounds(int x,
int y)
Returns true if the pixel coordinate is inside the image or false if not.
|
boolean |
isSubimage()
If this matrix is a sub-image or not.
|
abstract void |
reshape(int width,
int height)
Changes the width and height of the image.
|
void |
setHeight(int height) |
void |
setStartIndex(int startIndex) |
void |
setStride(int stride) |
abstract void |
setTo(T orig)
Sets the value of 'this' image to be identical to the passed in image.
|
void |
setWidth(int width) |
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. |
abstract T |
subimage(int x0,
int y0,
int x1,
int y1,
T subimage)
Creates a rectangular sub-image from 'this' image.
|
public int startIndex
public int stride
public int width
public int height
public boolean 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).
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.public T subimage(int x0, int y0, int x1, int y1)
subimage(int, int, int, int, ImageBase), but sets the storage for the input subimage
to null.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.public abstract void reshape(int width,
int height)
width - Desired image widthheight - Desired image heightpublic abstract void setTo(T orig)
orig - Image for which 'this' is to be a copy of.public boolean isSubimage()
public final boolean isInBounds(int x,
int y)
x - pixel location x-axisy - pixel location y-axispublic int getIndex(int x,
int y)
public final int getWidth()
public final void setWidth(int width)
public final int getHeight()
public final void setHeight(int height)
public int getStartIndex()
public void setStartIndex(int startIndex)
public int getStride()
public void setStride(int stride)
public georegression.struct.point.Point2D_I32 indexToPixel(int index)
public abstract T _createNew(int imgWidth, int imgHeight)
imgWidth - Width of the new imageimgHeight - height of the new imagepublic ImageType<T> getImageType()
public T createSameShape()
_createNew(int, int) with this image's width and height.public T clone()
clone in class java.lang.Object