public class MBFImage extends MultiBandImage<Float,MBFImage,FImage>
Image.Field
bands, colourSpace
Constructor and Description |
---|
MBFImage()
Construct an empty MBFImage with a the default RGB colourspace
|
MBFImage(ColourSpace colourSpace,
FImage... images)
Construct an MBFImage from single band images.
|
MBFImage(double[] ds,
int width,
int height,
int nbands,
boolean interlaced)
Create an MBFImage from an array of double values with the given width
and height.
|
MBFImage(FImage... images)
Construct an MBFImage from single band images with the default RGB
colourspace if there are three images, RGBA if there are 4 images, or
CUSTOM otherwise.
|
MBFImage(int[] data,
int width,
int height)
Create an image from a BufferedImage object.
|
MBFImage(int[] data,
int width,
int height,
boolean alpha)
Create an image from a int[] object.
|
MBFImage(int width,
int height)
Construct an empty RGB image (3 bands)
|
MBFImage(int width,
int height,
ColourSpace colourSpace)
Construct an empty image
|
MBFImage(int width,
int height,
int nbands)
Construct an empty image.
|
Modifier and Type | Method and Description |
---|---|
protected Float[] |
createPixelArray(int n)
Create an array of n pixels
|
MBFImageRenderer |
createRenderer()
Create a
ImageRenderer capable of drawing into this image. |
MBFImageRenderer |
createRenderer(RenderHints options)
Create a
ImageRenderer capable of drawing into this image. |
static MBFImage |
createRGB(FImage image)
|
MBFImage |
fill(Float[] colour)
Fill this image with the given colour.
|
FImage |
flatten()
Flatten the bands into a single band using the average value of the
pixels at each location.
|
FImage |
flattenMax()
Flatten the bands into a single band by selecting the maximum value pixel
from each band.
|
double[] |
getDoublePixelVector()
Returns the pixels of the image as a vector (array) of doubles.
|
Float[] |
getPixel(int x,
int y)
Get the value of the pixel at coordinate
(x, y) . |
Comparator<? super Float[]> |
getPixelComparator()
Returns a pixel comparator that is able to compare equality of pixels in
the given image type.
|
Float[] |
getPixelInterp(double x,
double y)
Get the value of a sub-pixel using linear-interpolation.
|
Float[] |
getPixelInterp(double x,
double y,
Float[] b)
Get the value of a sub-pixel using linear-interpolation.
|
float[] |
getPixelNative(int x,
int y)
Get the value of the pixel at coordinate
(x, y) . |
float[] |
getPixelNative(Pixel p)
Get the value of the pixel at coordinate p
|
float[][] |
getPixelVectorNative(float[][] f)
Returns the pixels in this image as a vector (an array of the pixel
type).
|
MBFImage |
internalAssign(byte[] bytes,
int width,
int height)
Assign planar RGB bytes (R1G1B1R2G2B2...) to this image.
|
MBFImage |
internalAssign(int[] data,
int width,
int height)
Copy pixels from given ARGB buffer image into this image.
|
protected Float |
intToT(int n)
Converts the given integer to a value that can be used as a pixel value.
|
FImage |
newBandInstance(int width,
int height)
Returns a new instance of an image that represents each band.
|
MBFImage |
newInstance()
Returns a new instance of a this image type.
|
MBFImage |
newInstance(int width,
int height)
Create a new instance of this image subclass with given dimensions.
|
MBFImage |
overlayInplace(MBFImage image,
int x,
int y)
Overlays the given image on this image directly.
|
static MBFImage |
randomImage(int width,
int height)
Create a random RGB image.
|
void |
setPixel(int x,
int y,
Float[] val)
Sets the pixel at
(x,y) to the given value. |
void |
setPixelNative(int x,
int y,
float[] val)
Sets the pixel at
(x,y) to the given value. |
abs, add, addBand, addInplace, addInplace, addInplace, addInplace, addInplace, clip, clip, clipMax, clipMax, clipMin, clipMin, clone, deleteBand, divide, divideInplace, divideInplace, divideInplace, divideInplace, divideInplace, equals, extractCentreSubPix, extractROI, extractROI, flipX, flipY, getBand, getColourSpace, getContentArea, getField, getFieldCopy, getFieldInterpolate, getHeight, getWidth, internalAssign, internalCopy, inverse, iterator, max, min, multiply, multiplyInplace, multiplyInplace, multiplyInplace, multiplyInplace, multiplyInplace, normalise, numBands, process, process, process, process, processInplace, processInplace, processInplace, processInplace, replace, shiftLeftInplace, shiftRightInplace, subtract, subtractInplace, subtractInplace, subtractInplace, subtractInplace, subtractInplace, threshold, threshold, toByteImage, toPackedARGBPixels, zero
accumulateWith, add, add, analyseWith, analyseWith, analyseWithMasked, combineWith, defaultBackgroundColour, defaultForegroundColour, divide, divide, drawConnectedPoints, drawCubicBezier, drawImage, drawImage, drawImage, drawLine, drawLine, drawLine, drawLine, drawLine, drawLine, drawLine, drawLines, drawPath, drawPaths, drawPoint, drawPoints, drawPolygon, drawPolygon, drawPolygonFilled, drawShape, drawShape, drawShapeFilled, drawText, drawText, drawText, drawText, drawText, drawText, drawText, drawText, extractCenter, extractCenter, extractCentreSubPix, extractCentreSubPix, extractCentreSubPix, extractROI, getBounds, getCols, getImage, getPixel, getPixelVector, getRows, multiply, multiply, overlay, padding, padding, paddingSymmetric, process, process, process, process, process, process, processInplace, processInplace, processInplace, processInplace, processInplace, processMasked, processMaskedInplace, shiftDown, shiftDown, shiftDownInplace, shiftDownInplace, shiftLeft, shiftLeft, shiftLeftInplace, shiftRight, shiftRight, shiftRightInplace, shiftUp, shiftUp, shiftUpInplace, shiftUpInplace, subtract, subtract, transform, trim
finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
forEach, spliterator
public MBFImage()
public MBFImage(ColourSpace colourSpace, FImage... images)
colourSpace
- the colourspaceimages
- the bandspublic MBFImage(FImage... images)
MBFImage
from a single
FImage
, you would need to clone the FImage
at least
twice.images
- the bandspublic MBFImage(int width, int height)
width
- Width of imageheight
- Height of imagepublic MBFImage(int width, int height, ColourSpace colourSpace)
width
- Width of imageheight
- Height of imagecolourSpace
- the colourspacepublic MBFImage(int width, int height, int nbands)
width
- Width of imageheight
- Height of imagenbands
- number of bandspublic MBFImage(int[] data, int width, int height)
data
- array of packed ARGB pixelswidth
- the image widthheight
- the image heightpublic MBFImage(int[] data, int width, int height, boolean alpha)
data
- array of packed ARGB pixelswidth
- the image widthheight
- the image heightalpha
- should we load the alpha channelpublic MBFImage(double[] ds, int width, int height, int nbands, boolean interlaced)
ds
- An array of floating point values.width
- The width of the resulting image.height
- The height of the resulting image.nbands
- the number of bandsinterlaced
- if true the data in the array is interlacedpublic FImage flattenMax()
MultiBandImage
flattenMax
in class MultiBandImage<Float,MBFImage,FImage>
public FImage flatten()
MultiBandImage
flatten
in class MultiBandImage<Float,MBFImage,FImage>
public Float[] getPixel(int x, int y)
Image
(x, y)
.public Comparator<? super Float[]> getPixelComparator()
Image
getPixelComparator
in class Image<Float[],MBFImage>
Comparator
that compares pixels.public Float[] getPixelInterp(double x, double y)
Image
getPixelInterp
in class Image<Float[],MBFImage>
x
- The x-ordinate to gety
- The y-ordinate to get(x,y)
public Float[] getPixelInterp(double x, double y, Float[] b)
Image
getPixelInterp
in class Image<Float[],MBFImage>
x
- The x-ordinate to get.y
- The y-ordinate to get.b
- The colour of the background pixel.(x,y)
public MBFImage internalAssign(byte[] bytes, int width, int height)
bytes
- the byte arraywidth
- the width of the byte imageheight
- the height of the byte imagepublic MBFImage internalAssign(int[] data, int width, int height)
Image
internalAssign
in class Image<Float[],MBFImage>
data
- buffer of ARGB packed integer pixelswidth
- the width of the bufferheight
- the height of the bufferprotected Float intToT(int n)
MultiBandImage
intToT
in class MultiBandImage<Float,MBFImage,FImage>
n
- The integer to convert.public FImage newBandInstance(int width, int height)
MultiBandImage
newBandInstance
in class MultiBandImage<Float,MBFImage,FImage>
width
- The width of the imageheight
- The height of the imageSingleBandImage
of the appropriate type.public MBFImage newInstance()
MultiBandImage
newInstance
in class MultiBandImage<Float,MBFImage,FImage>
MBFImage
subclass type.public MBFImage newInstance(int width, int height)
MultiBandImage
newInstance
in class MultiBandImage<Float,MBFImage,FImage>
width
- The image widthheight
- The image heightI
Image.newInstance(int, int)
public MBFImageRenderer createRenderer()
Image
ImageRenderer
capable of drawing into this image.createRenderer
in class Image<Float[],MBFImage>
public MBFImageRenderer createRenderer(RenderHints options)
Image
ImageRenderer
capable of drawing into this image.createRenderer
in class Image<Float[],MBFImage>
options
- Options for the rendererpublic float[] getPixelNative(Pixel p)
p
- The coordinate to getpublic float[] getPixelNative(int x, int y)
(x, y)
.x
- The x-coordinate to gety
- The y-coordinate to getpublic float[][] getPixelVectorNative(float[][] f)
f
- The array into which to place the datapublic void setPixelNative(int x, int y, float[] val)
(x,y)
to the given value. Side-affects
this image.x
- The x-coordinate of the pixel to sety
- The y-coordinate of the pixel to setval
- The value to set the pixel to.public MBFImage overlayInplace(MBFImage image, int x, int y)
This method assumes the last band in the multiband image is the alpha channel. This allows a 2-channel MBFImage where the first image is an FImage and the second an alpha channel, as well as a standard RGBA image.
overlayInplace
in class Image<Float[],MBFImage>
image
- The image to overlayx
- The location at which to overlay the imagey
- The location at which to overlay the imageImage.overlayInplace(org.openimaj.image.Image,
int, int)
public static MBFImage randomImage(int width, int height)
width
- the widthheight
- the heightpublic MBFImage fill(Float[] colour)
MultiBandImage
fill
in class MultiBandImage<Float,MBFImage,FImage>
colour
- the colour to fill the image withImage.fill(java.lang.Object)
public void setPixel(int x, int y, Float[] val)
MultiBandImage
(x,y)
to the given value. Side-affects
this image.setPixel
in class MultiBandImage<Float,MBFImage,FImage>
x
- The x-ordinate of the pixel to sety
- The y-ordinate of the pixel to setval
- The value to set the pixel to.Image.setPixel(int, int, java.lang.Object)
protected Float[] createPixelArray(int n)
MultiBandImage
createPixelArray
in class MultiBandImage<Float,MBFImage,FImage>
n
- number of pixelspublic double[] getDoublePixelVector()