T
- The pixel typeI
- The concrete subclass typeS
- The concrete subclass type of each bandpublic abstract class MultiBandImage<T extends Comparable<T>,I extends MultiBandImage<T,I,S>,S extends SingleBandImage<T,S>> extends Image<T[],I> implements Iterable<S>, SinglebandImageProcessor.Processable<T,S,I>, SinglebandKernelProcessor.Processable<T,S,I>
Image.Field
Modifier and Type | Field and Description |
---|---|
List<S> |
bands
The images for each band in a list
|
ColourSpace |
colourSpace
The colour-space of this image
|
Constructor and Description |
---|
MultiBandImage()
Default constructor for a multiband image.
|
MultiBandImage(ColourSpace colourSpace)
Default constructor for a multiband image.
|
MultiBandImage(ColourSpace colourSpace,
S... images)
Construct a multiband image using each of the given images as the bands
(in order).
|
Modifier and Type | Method and Description |
---|---|
I |
abs()
Set all pixels to their absolute values, so that all pixel values in the
image will be greater than zero.
|
I |
add(T num)
Add the given scalar to each pixel of each band and return result as a
new image.
|
void |
addBand(S img)
Adds a new band image to the multiband image.
|
I |
addInplace(Image<?,?> im)
Add the given image to this image (side-affects this image).
|
I |
addInplace(MultiBandImage<?,?,?> im)
Adds to each pixel the value of the corresponding pixel in the
corresponding band in the given image.
|
I |
addInplace(SingleBandImage<?,?> im)
Adds to each pixel (in all bandS) the value of corresponding pixel in the
given image.
|
I |
addInplace(T num)
Add the given value to each pixel in every band.
|
I |
addInplace(T[] num)
Add a scalar to each pixel in this image (side-affects this image).
|
I |
clip(T[] min,
T[] max)
Sets any pixels that are below
min to zero or above
max to the highest normal value that the image allows
(usually 1 for floating-point images). |
I |
clip(T min,
T max)
Sets any pixels that are below min to zero or above max to the highest
normal value that the image allows (usually 1 for floating-point images).
|
I |
clipMax(T thresh)
For all bands, sets any values above the given threshold to zero.
|
I |
clipMax(T[] thresh)
Set all values greater than the given value to the highest normal value
that the image allows (usually 1 for floating-point images).
|
I |
clipMin(T thresh)
Sets all pixels in all bands that have a value below the given threshold
to zero.
|
I |
clipMin(T[] thresh)
Set all values less than the given value to zero.
|
I |
clone()
Deep copy of an image (internal image buffers copied).
|
protected abstract T[] |
createPixelArray(int n)
Create an array of n pixels
|
void |
deleteBand(int index)
Delete the band at the given index.
|
I |
divide(T val)
Divides all pixels of each band by the given value and returns result as
a new image.
|
I |
divideInplace(Image<?,?> im)
Divide each pixel in this image by the corresponding pixel value in the
given image.
|
I |
divideInplace(MultiBandImage<?,?,?> im)
Divides the pixels in every band of this image by the corresponding pixel
in the corresponding band of the given image.
|
I |
divideInplace(SingleBandImage<?,?> im)
Divides the pixels in every band of this image by the corresponding pixel
in the given image.
|
I |
divideInplace(T val)
Divide all pixels of every band by the given value.
|
I |
divideInplace(T[] val)
Divide each pixel of the image by the given scalar value.
|
boolean |
equals(Object other) |
I |
extractCentreSubPix(float cx,
float cy,
I out)
Sub-pixel sampling of a centred rectangular region such that
dst(x, y) = src(x + center.x (width(dst) 1) ⇤ 0.5, y + center.y (height(dst) 1) ⇤ 0.5)
. |
I |
extractROI(int x,
int y,
I out)
Extract a rectangular region of interest from this image and put it in
the given image.
|
I |
extractROI(int x,
int y,
int w,
int h)
Extract a rectangular region of interest of the given width and height.
|
I |
fill(T[] colour)
Fill this image with the given colour.
|
S |
flatten()
Flatten the bands into a single band using the average value of the
pixels at each location.
|
abstract S |
flattenMax()
Flatten the bands into a single band by selecting the maximum value pixel
from each band.
|
I |
flipX()
Flips the content horizontally.
|
I |
flipY()
Flips the content vertically.
|
S |
getBand(int i)
Get the band at index i.
|
ColourSpace |
getColourSpace()
Get the colour space of this image
|
Rectangle |
getContentArea()
Get bounding box of non-zero-valued pixels around the outside of the
image.
|
I |
getField(Image.Field f)
Get the given field of this image.
|
I |
getFieldCopy(Image.Field f)
Get the given field of this image, maintaining the image's aspect ratio
by doubling the fields.
|
I |
getFieldInterpolate(Image.Field f)
Get the given field of this image, maintaining the image's aspect ratio
by interpolating between the fields.
|
int |
getHeight()
Returns the image height in pixels.
|
int |
getWidth()
Get the width (number of columns) in this image.
|
I |
internalAssign(I im)
Assign the internal state from another image of the same type.
|
I |
internalCopy(I im)
Copy the internal state from another image of the same type.
|
protected abstract T |
intToT(int n)
Converts the given integer to a value that can be used as a pixel value.
|
I |
inverse()
Invert the image pixels by finding the maximum value and subtracting each
pixel value from that maximum.
|
Iterator<S> |
iterator() |
T[] |
max()
Find the maximum pixel value.
|
T[] |
min()
Find the minimum pixel value.
|
I |
multiply(T num)
Multiplies each pixel of every band by the given value and returns the
result as a new image.
|
I |
multiplyInplace(Image<?,?> im)
Multiply each pixel in this image by the corresponding pixel in the given
image.
|
I |
multiplyInplace(MultiBandImage<?,?,?> im)
Multiplies every pixel in this image by the corresponding pixel in the
corresponding band in the given image.
|
I |
multiplyInplace(SingleBandImage<?,?> im)
Multiplies every pixel in this image by the corresponding pixel in the
given image.
|
I |
multiplyInplace(T num)
Multiplies each pixel of every band by the given value.
|
I |
multiplyInplace(T[] num)
Multiply each pixel of this by the given scalar.
|
abstract S |
newBandInstance(int width,
int height)
Returns a new instance of an image that represents each band.
|
abstract I |
newInstance()
Returns a new instance of a this image type.
|
abstract I |
newInstance(int width,
int height)
Create a new instance of this image subclass with given dimensions.
|
I |
normalise()
Normalise all pixel values to fall within the range 0.0 - 1.0.
|
int |
numBands()
Returns the number of bands in this image.
|
I |
process(SinglebandImageProcessor<T,S> p)
Process with the given
SinglebandImageProcessor returning a
new image. |
I |
process(SinglebandKernelProcessor<T,S> kernel) |
I |
process(SinglebandKernelProcessor<T,S> kernel,
boolean pad) |
I |
process(SinglebandPixelProcessor<T> pp)
Processes this image with the given
SinglebandImageProcessor for
every band. |
I |
processInplace(SinglebandImageProcessor<T,S> p)
Process with the given
SinglebandImageProcessor storing the
result in this processable image. |
I |
processInplace(SinglebandKernelProcessor<T,S> kernel) |
I |
processInplace(SinglebandKernelProcessor<T,S> kernel,
boolean pad) |
I |
processInplace(SinglebandPixelProcessor<T> pp)
Process this image with the given
SinglebandImageProcessor for
every band. |
I |
replace(T[] target,
T[] replacement)
Replace pixels of a certain colour with another colour.
|
void |
setPixel(int x,
int y,
T[] val)
Sets the pixel at
(x,y) to the given value. |
I |
shiftLeftInplace(int count)
Shifts all the pixels to the left by count pixel
|
I |
shiftRightInplace(int count)
Shifts all the pixels to the right by count pixel
|
I |
subtract(T num)
Subtracts the given value from every pixel in every band and returns the
result as a new image.
|
I |
subtractInplace(Image<?,?> im)
Subtract the corresponding pixel value from the given image from the
pixel values in this image.
|
I |
subtractInplace(MultiBandImage<?,?,?> im)
Subtracts from every pixel in every band the corresponding pixel value in
the corresponding band of the given image.
|
I |
subtractInplace(SingleBandImage<?,?> im)
Subtracts from every pixel in every band the corresponding pixel value in
the given image.
|
I |
subtractInplace(T num)
Subtracts the given value from every pixel in every band.
|
I |
subtractInplace(T[] num)
Subtract a scalar from every pixel value in this image.
|
I |
threshold(T thresh)
Sets the value of any pixel below the given threshold to zero and all
others to 1 for all bands.
|
I |
threshold(T[] thresh)
Set all values less than the given threshold to 0 and all others to 1.
|
byte[] |
toByteImage()
Convert the image to a byte representation suitable for writing to a pnm
type format.
|
int[] |
toPackedARGBPixels()
Returns a 1D array representation of this image with each pixel
represented as a packed ARGB integer.
|
I |
zero()
Set all pixels in the image to zero.
|
accumulateWith, add, add, analyseWith, analyseWith, analyseWithMasked, combineWith, createRenderer, createRenderer, 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, getPixel, getPixelComparator, getPixelInterp, getPixelInterp, getPixelVector, getRows, internalAssign, multiply, multiply, overlay, overlayInplace, 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 ColourSpace colourSpace
public MultiBandImage()
public MultiBandImage(ColourSpace colourSpace)
colourSpace
- the colour space@SafeVarargs public MultiBandImage(ColourSpace colourSpace, S... images)
colourSpace
- the colour spaceimages
- A set of images to use as the bands in the image.public I abs()
abs
in class Image<T extends Comparable<T>[],I extends MultiBandImage<T,I,S>>
Image.abs()
public I add(T num)
num
- The value to add to each pixel in every band.public void addBand(S img)
img
- The image to add as a new band.public I addInplace(Image<?,?> im)
MultiBandImage
or a
SingleBandImage
.addInplace
in class Image<T extends Comparable<T>[],I extends MultiBandImage<T,I,S>>
im
- The image to add to this imageUnsupportedOperationException
- if the given image is neither a MultiBandImage
nor a
SingleBandImage
.Image.addInplace(org.openimaj.image.Image)
public I addInplace(MultiBandImage<?,?,?> im)
im
- The image to add to this image.public I addInplace(SingleBandImage<?,?> im)
im
- The image to add to this image.public I addInplace(T num)
num
- The value to add to each pixelpublic I addInplace(T[] num)
addInplace
in class Image<T extends Comparable<T>[],I extends MultiBandImage<T,I,S>>
num
- The value to add to every pixel in this image.Image.addInplace(java.lang.Object)
public I clip(T min, T max)
min
- The minimum value to clip tomax
- The maximum value to clip to.Image.clip(Object, Object)
public I clip(T[] min, T[] max)
min
to zero or above
max
to the highest normal value that the image allows
(usually 1 for floating-point images). This method may side-affect this
image.clip
in class Image<T extends Comparable<T>[],I extends MultiBandImage<T,I,S>>
min
- The minimum valuemax
- The maximum valueImage.clip(java.lang.Object, java.lang.Object)
public I clipMax(T thresh)
thresh
- The threshold above which values are clippedpublic I clipMax(T[] thresh)
clipMax
in class Image<T extends Comparable<T>[],I extends MultiBandImage<T,I,S>>
thresh
- The value over which pixels are clipped to zero.Image.clipMax(java.lang.Object)
public I clipMin(T thresh)
thresh
- The threshold below which pixels will be set to zero.public I clipMin(T[] thresh)
clipMin
in class Image<T extends Comparable<T>[],I extends MultiBandImage<T,I,S>>
thresh
- The value below which pixels are clipped to zero.Image.clipMin(java.lang.Object)
public I clone()
clone
in class Image<T extends Comparable<T>[],I extends MultiBandImage<T,I,S>>
Image.clone()
public void deleteBand(int index)
index
- The index of the band to remove.public I divide(T val)
val
- The value to divide every pixel by.public I divideInplace(Image<?,?> im)
divideInplace
in class Image<T extends Comparable<T>[],I extends MultiBandImage<T,I,S>>
im
- image The image to divide this image by.Image.divideInplace(org.openimaj.image.Image)
public I divideInplace(MultiBandImage<?,?,?> im)
im
- The image to divide into this image.public I divideInplace(SingleBandImage<?,?> im)
im
- The image to divide into this image.public I divideInplace(T val)
val
- The value to divide bypublic I divideInplace(T[] val)
divideInplace
in class Image<T extends Comparable<T>[],I extends MultiBandImage<T,I,S>>
val
- The value to divide each pixel by.Image.divideInplace(java.lang.Object)
public I extractROI(int x, int y, I out)
(0,0)
is the top-left corner.
The width and height of the extracted image should be determined from the
given image's width and height.extractROI
in class Image<T extends Comparable<T>[],I extends MultiBandImage<T,I,S>>
x
- The leftmost coordinate of the rectangle to extracty
- The topmost coordinate of the rectangle to extractout
- The destination imageImage.extractROI(int, int,
org.openimaj.image.Image)
public I extractROI(int x, int y, int w, int h)
(0,0)
is the top-left corner. Returns a new
image.extractROI
in class Image<T extends Comparable<T>[],I extends MultiBandImage<T,I,S>>
x
- The leftmost coordinate of the rectangle to extracty
- The topmost coordinate of the rectangle to extractw
- The width of the rectangle to extracth
- The height of the rectangle to extractImage.extractROI(int, int, int, int)
public I fill(T[] colour)
fill
in class Image<T extends Comparable<T>[],I extends MultiBandImage<T,I,S>>
colour
- the colour to fill the image withImage.fill(java.lang.Object)
public S flatten()
public abstract S flattenMax()
public S getBand(int i)
i
- the indexpublic ColourSpace getColourSpace()
public Rectangle getContentArea()
Image.trim()
.getContentArea
in class Image<T extends Comparable<T>[],I extends MultiBandImage<T,I,S>>
Image.getContentArea()
public I getField(Image.Field f)
getField
in class Image<T extends Comparable<T>[],I extends MultiBandImage<T,I,S>>
f
- The Image.Field
to extract from this imageImage.getField(org.openimaj.image.Image.Field)
public I getFieldCopy(Image.Field f)
getFieldCopy
in class Image<T extends Comparable<T>[],I extends MultiBandImage<T,I,S>>
f
- The Image.Field
to extract from this imageImage.getFieldCopy(org.openimaj.image.Image.Field)
public I getFieldInterpolate(Image.Field f)
getFieldInterpolate
in class Image<T extends Comparable<T>[],I extends MultiBandImage<T,I,S>>
f
- The Image.Field
to extract from this image.Image.getFieldInterpolate(org.openimaj.image.Image.Field)
public int getHeight()
getHeight
in class Image<T extends Comparable<T>[],I extends MultiBandImage<T,I,S>>
Image.getHeight()
public int getWidth()
getWidth
in class Image<T extends Comparable<T>[],I extends MultiBandImage<T,I,S>>
Image.getWidth()
public I internalCopy(I im)
internalCopy
in class Image<T extends Comparable<T>[],I extends MultiBandImage<T,I,S>>
im
- The source image to make a copy of.Image.internalAssign(org.openimaj.image.Image)
public I internalAssign(I im)
internalAssign
in class Image<T extends Comparable<T>[],I extends MultiBandImage<T,I,S>>
im
- The source image to make a copy of.Image.internalAssign(org.openimaj.image.Image)
protected abstract T intToT(int n)
n
- The integer to convert.public I inverse()
inverse
in class Image<T extends Comparable<T>[],I extends MultiBandImage<T,I,S>>
Image.inverse()
public Iterator<S> iterator()
iterator
in interface Iterable<S extends SingleBandImage<T,S>>
Iterable.iterator()
public T[] max()
max
in class Image<T extends Comparable<T>[],I extends MultiBandImage<T,I,S>>
Image.max()
public T[] min()
min
in class Image<T extends Comparable<T>[],I extends MultiBandImage<T,I,S>>
Image.min()
protected abstract T[] createPixelArray(int n)
n
- number of pixelspublic I multiply(T num)
num
- The value to multiply by.public I multiplyInplace(Image<?,?> im)
multiplyInplace
in class Image<T extends Comparable<T>[],I extends MultiBandImage<T,I,S>>
im
- The image to multiply with this image.Image.multiplyInplace(org.openimaj.image.Image)
public I multiplyInplace(MultiBandImage<?,?,?> im)
im
- The image to multiply with this image.public I multiplyInplace(SingleBandImage<?,?> im)
im
- The image to multiply with this image.public I multiplyInplace(T num)
num
- The value to multiply this image bypublic I multiplyInplace(T[] num)
multiplyInplace
in class Image<T extends Comparable<T>[],I extends MultiBandImage<T,I,S>>
num
- The scalar to multiply this image by.Image.multiplyInplace(java.lang.Object)
public abstract S newBandInstance(int width, int height)
width
- The width of the imageheight
- The height of the imageSingleBandImage
of the appropriate type.public abstract I newInstance()
MBFImage
subclass type.public abstract I newInstance(int width, int height)
newInstance
in class Image<T extends Comparable<T>[],I extends MultiBandImage<T,I,S>>
width
- The image widthheight
- The image heightI
Image.newInstance(int, int)
public I normalise()
normalise
in class Image<T extends Comparable<T>[],I extends MultiBandImage<T,I,S>>
Image.normalise()
public int numBands()
public I process(SinglebandImageProcessor<T,S> p)
SinglebandImageProcessor
returning a
new image.process
in interface SinglebandImageProcessor.Processable<T extends Comparable<T>,S extends SingleBandImage<T,S>,I extends MultiBandImage<T,I,S>>
p
- The processor to process the image withSinglebandImageProcessor.Processable.process(org.openimaj.image.processor.SinglebandImageProcessor)
public I process(SinglebandKernelProcessor<T,S> kernel)
process
in interface SinglebandKernelProcessor.Processable<T extends Comparable<T>,S extends SingleBandImage<T,S>,I extends MultiBandImage<T,I,S>>
kernel
- the processorSinglebandKernelProcessor.Processable.process(org.openimaj.image.processor.SinglebandKernelProcessor)
public I process(SinglebandKernelProcessor<T,S> kernel, boolean pad)
process
in interface SinglebandKernelProcessor.Processable<T extends Comparable<T>,S extends SingleBandImage<T,S>,I extends MultiBandImage<T,I,S>>
kernel
- the processorpad
- Should the image be zero padded so the
kernel reaches the edges of the outputSinglebandKernelProcessor.Processable.process(org.openimaj.image.processor.SinglebandKernelProcessor,
boolean)
public I process(SinglebandPixelProcessor<T> pp)
SinglebandImageProcessor
for
every band.pp
- The pixel process to apply to each band in turn.public I processInplace(SinglebandImageProcessor<T,S> p)
SinglebandImageProcessor
storing the
result in this processable image. Side-affects this processable
image.processInplace
in interface SinglebandImageProcessor.Processable<T extends Comparable<T>,S extends SingleBandImage<T,S>,I extends MultiBandImage<T,I,S>>
p
- The processor to process the image withSinglebandImageProcessor.Processable.processInplace(org.openimaj.image.processor.SinglebandImageProcessor)
public I processInplace(SinglebandKernelProcessor<T,S> kernel)
processInplace
in interface SinglebandKernelProcessor.Processable<T extends Comparable<T>,S extends SingleBandImage<T,S>,I extends MultiBandImage<T,I,S>>
kernel
- the processorSinglebandKernelProcessor.Processable.processInplace(org.openimaj.image.processor.SinglebandKernelProcessor)
public I processInplace(SinglebandKernelProcessor<T,S> kernel, boolean pad)
processInplace
in interface SinglebandKernelProcessor.Processable<T extends Comparable<T>,S extends SingleBandImage<T,S>,I extends MultiBandImage<T,I,S>>
kernel
- the processorpad
- Should the image be zero padded so the
kernel reaches the edges of the outputSinglebandKernelProcessor.Processable.processInplace(org.openimaj.image.processor.SinglebandKernelProcessor,
boolean)
public I processInplace(SinglebandPixelProcessor<T> pp)
SinglebandImageProcessor
for
every band. Side-affects this image.pp
- The pixel processor to apply to each band in turn.public void setPixel(int x, int y, T[] val)
(x,y)
to the given value. Side-affects
this image.setPixel
in class Image<T extends Comparable<T>[],I extends MultiBandImage<T,I,S>>
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)
public I subtract(T num)
num
- The value to subtract from this image.public I subtractInplace(Image<?,?> im)
subtractInplace
in class Image<T extends Comparable<T>[],I extends MultiBandImage<T,I,S>>
im
- The image to subtract from this image.Image.subtractInplace(org.openimaj.image.Image)
public I subtractInplace(MultiBandImage<?,?,?> im)
im
- The image to subtract from this imagepublic I subtractInplace(SingleBandImage<?,?> im)
im
- The image to subtract from this image.public I subtractInplace(T num)
num
- The value to subtract from this imagepublic I subtractInplace(T[] num)
subtractInplace
in class Image<T extends Comparable<T>[],I extends MultiBandImage<T,I,S>>
num
- A value to subtract from each pixel.Image.subtractInplace(java.lang.Object)
public I threshold(T thresh)
thresh
- The threshold above which pixels will be set to 1.public I threshold(T[] thresh)
threshold
in class Image<T extends Comparable<T>[],I extends MultiBandImage<T,I,S>>
thresh
- The threshold valueImage.threshold(java.lang.Object)
public byte[] toByteImage()
toByteImage
in class Image<T extends Comparable<T>[],I extends MultiBandImage<T,I,S>>
Image.toByteImage()
public int[] toPackedARGBPixels()
toPackedARGBPixels
in class Image<T extends Comparable<T>[],I extends MultiBandImage<T,I,S>>
Image.toPackedARGBPixels()
public I zero()
zero
in class Image<T extends Comparable<T>[],I extends MultiBandImage<T,I,S>>
Image.zero()
public I shiftLeftInplace(int count)
Image
shiftLeftInplace
in class Image<T extends Comparable<T>[],I extends MultiBandImage<T,I,S>>
count
- The number of pixelspublic I shiftRightInplace(int count)
Image
shiftRightInplace
in class Image<T extends Comparable<T>[],I extends MultiBandImage<T,I,S>>
count
- The number of pixelspublic I flipX()
Image
flipX
in class Image<T extends Comparable<T>[],I extends MultiBandImage<T,I,S>>
public I flipY()
Image
flipY
in class Image<T extends Comparable<T>[],I extends MultiBandImage<T,I,S>>
public I replace(T[] target, T[] replacement)
Image
replace
in class Image<T extends Comparable<T>[],I extends MultiBandImage<T,I,S>>
target
- the colour to fill the image withreplacement
- the colour to fill the image withpublic I extractCentreSubPix(float cx, float cy, I out)
Image
dst(x, y) = src(x + center.x (width(dst) 1) ⇤ 0.5, y + center.y (height(dst) 1) ⇤ 0.5)
. Sub-pixels values are estimated using bilinear interpolation.extractCentreSubPix
in class Image<T extends Comparable<T>[],I extends MultiBandImage<T,I,S>>
cx
- the x-ordinate of the centrecy
- the y-ordinate of the centreout
- the output image (also defines the size of the extracted
region)out
Image.getPixelInterp(double, double)