public class FImage extends SingleBandImage<Float,FImage>
FImage
s can be created from PGM files or from pixel arrays. If you
wish to read other types of files then use the ImageUtilities
class
that provides read/write functions for Image
objects.
Image.Field
Modifier and Type | Field and Description |
---|---|
protected static float |
DEFAULT_GAUSS_TRUNCATE
The default number of sigmas at which the Gaussian function is truncated
when building a kernel
|
protected static org.apache.log4j.Logger |
logger
The logging class
|
float[][] |
pixels
The underlying pixels
|
height, width
Constructor and Description |
---|
FImage(double[] array,
int width,
int height)
Create an
FImage from an array of double values with the given
width and height. |
FImage(double[] array,
int width,
int height,
int offset)
Create an
FImage from an array of double values with the given
width and height. |
FImage(float[][] array)
Create an
FImage from an array of floating point values. |
FImage(float[] array,
int width,
int height)
Create an
FImage from an array of floating point values with the
given width and height. |
FImage(int[] data,
int width,
int height)
Construct an
FImage from an array of packed ARGB integers. |
FImage(int[] data,
int width,
int height,
ARGBPlane plane)
Construct an
FImage from an array of packed ARGB integers using
the specified plane. |
FImage(int width,
int height)
Create an empty
FImage of the given size. |
Modifier and Type | Method and Description |
---|---|
FImage |
abs()
Set all pixels to their absolute values, so that all pixel values in the
image will be greater than zero.
|
FImage |
add(FImage im)
Adds the pixel values of the given
FImage to the pixels of this
image. |
FImage |
add(Float num)
Returns a new
FImage that contains the pixels of this image
increased by the given value. |
FImage |
add(Image<?,?> im)
Adds the given image to this image and return new image.
|
FImage |
addInplace(FImage im)
Adds the given image pixel values to the pixel values of this image.
|
FImage |
addInplace(Float num)
Add a scalar to each pixel in this image (side-affects this image).
|
FImage |
addInplace(Image<?,?> im)
Add the given image to this image (side-affects this image).
|
void |
analyseWith(PixelAnalyser<Float> p)
Analyse this image with a
PixelAnalyser . |
FImage |
clip(Float min,
Float 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). |
FImage |
clipMax(Float thresh)
Set all values greater than the given value to the highest normal value
that the image allows (usually 1 for floating-point images).
|
FImage |
clipMin(Float thresh)
Set all values less than the given value to zero.
|
FImage |
clone()
Deep copy of an image (internal image buffers copied).
|
static FImage[] |
createArray(int num,
int width,
int height)
Convenience method to initialise an array of FImages
|
FImageRenderer |
createRenderer()
Create a
ImageRenderer capable of drawing into this image. |
FImageRenderer |
createRenderer(RenderHints options)
Create a
ImageRenderer capable of drawing into this image. |
FImage |
divide(FImage im)
Divides the pixels values of this image with the values from the given
image.
|
FImage |
divideInplace(FImage im)
Divides the pixel values of this image with the values from the given
image.
|
FImage |
divideInplace(float fval)
Divide all pixels by a given value
|
FImage |
divideInplace(Float val)
Divide each pixel of the image by the given scalar value.
|
FImage |
divideInplace(Image<?,?> im)
Divide each pixel in this image by the corresponding pixel value in the
given image.
|
boolean |
equals(Object o) |
boolean |
equalsThresh(FImage o,
float thresh)
Compare this image against another using a threshold on the absolute
difference between pixel values in order to determine equality.
|
FImage |
extractCentreSubPix(float cx,
float cy,
FImage 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)
. |
FImage |
extractROI(int x,
int y,
FImage out)
Extract a rectangular region of interest from this image and put it in
the given image.
|
FImage |
extractROI(int x,
int y,
int w,
int h)
Extract a rectangular region of interest of the given width and height.
|
FImage |
fill(float colour)
Fill an image with the given colour
|
FImage |
fill(Float colour)
Fill this image with the given colour.
|
FImage |
flipX()
Flips the content horizontally.
|
FImage |
flipY()
Flips the content vertically.
|
Rectangle |
getContentArea()
Get bounding box of non-zero-valued pixels around the outside of the
image.
|
double[] |
getDoublePixelVector()
Returns the pixels of the image as a vector (array) of doubles.
|
FImage |
getField(Image.Field f)
Get the given field of this image.
|
FImage |
getFieldCopy(Image.Field f)
Get the given field of this image, maintaining the image's aspect ratio
by doubling the fields.
|
FImage |
getFieldInterpolate(Image.Field f)
Get the given field of this image, maintaining the image's aspect ratio
by interpolating between the fields.
|
float[] |
getFloatPixelVector()
Returns the pixels of the image as a vector (array) of floats.
|
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 background)
Get the value of a sub-pixel using linear-interpolation.
|
float |
getPixelInterpNative(float x,
float y,
float background)
Interpolate the value of a pixel at the given coordinates
|
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).
|
FImage |
internalAssign(FImage im)
Assign the internal state from another image of the same type.
|
FImage |
internalAssign(int[] data,
int width,
int height)
Copy pixels from given ARGB buffer image into this image.
|
FImage |
internalCopy(FImage im)
Copy the internal state from another image of the same type.
|
FImage |
inverse()
Invert the image pixels by finding the maximum value and subtracting each
pixel value from that maximum.
|
Float |
max()
Find the maximum pixel value.
|
FValuePixel |
maxPixel()
Get the pixel with the maximum value.
|
Float |
min()
Find the minimum pixel value.
|
FValuePixel |
minPixel()
Get the pixel with the minimum value.
|
FImage |
multiply(Float num)
Multiply each pixel of this by the given scalar and return new image.
|
FImage |
multiplyInplace(FImage im)
Multiplies this image's pixel values by the corresponding pixel values in
the given image side-affecting this image.
|
FImage |
multiplyInplace(float fnum)
Multiply all pixel values by the given value
|
FImage |
multiplyInplace(Float num)
Multiply each pixel of this by the given scalar.
|
FImage |
multiplyInplace(Image<?,?> im)
Multiply each pixel in this image by the corresponding pixel in the given
image.
|
FImage |
newInstance(int width,
int height)
Create a new instance of this image subclass with given dimensions.
|
FImage |
normalise()
Normalise all pixel values to fall within the range 0.0 - 1.0.
|
FImage |
overlayInplace(FImage img,
FImage alpha,
int x,
int y)
Overlay the given image on this image with the given alpha channel at the
given location.
|
FImage |
overlayInplace(FImage image,
int x,
int y)
Overlays the given image on this image directly.
|
FImage |
process(KernelProcessor<Float,FImage> p)
Process this image with the given
KernelProcessor and return new
image containing the result. |
FImage |
process(KernelProcessor<Float,FImage> p,
boolean pad)
Process this image with the given
KernelProcessor and return new
image containing the result. |
FImage |
processInplace(PixelProcessor<Float> p)
Process this image with the given
PixelProcessor side-affecting
this image. |
static FImage |
randomImage(int width,
int height)
Create a random image of the given size.
|
FImage |
replace(float target,
float replacement)
Replace pixels of a certain colour with another colour.
|
FImage |
replace(Float target,
Float replacement)
Replace pixels of a certain colour with another colour.
|
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. |
FImage |
subtract(FImage im)
Subtracts the given
FImage from this image returning a new image
containing the result. |
FImage |
subtract(Float num)
Subtract a scalar from every pixel value in this image and return new
image.
|
FImage |
subtract(Image<?,?> input)
Subtract the corresponding pixel value from the given image from the
pixel values in this image.
|
FImage |
subtractInplace(FImage im)
Subtracts (pixel-by-pixel) the given
FImage from this image. |
FImage |
subtractInplace(Float num)
Subtract a scalar from every pixel value in this image.
|
FImage |
subtractInplace(Image<?,?> im)
Subtract the corresponding pixel value from the given image from the
pixel values in this image.
|
float |
sum() |
FImage |
threshold(Float 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.
|
MBFImage |
toRGB()
|
String |
toString() |
String |
toString(String format)
Returns a string representation of every pixel in this image using the
format string (see
String.format(String, Object...) ) to format
each pixel value. |
FImage |
transform(Jama.Matrix transform)
Apply a transform matrix to the image and returns the result as a new
image.
|
FImage |
zero()
Set all pixels in the image to zero.
|
getHeight, getWidth, process, process, process, processInplace, processInplace, processInplace
accumulateWith, 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, overlay, padding, padding, paddingSymmetric, process, process, process, process, processInplace, processInplace, processInplace, processInplace, processMasked, processMaskedInplace, shiftDown, shiftDown, shiftDownInplace, shiftDownInplace, shiftLeft, shiftLeft, shiftLeftInplace, shiftLeftInplace, shiftRight, shiftRight, shiftRightInplace, shiftRightInplace, shiftUp, shiftUp, shiftUpInplace, shiftUpInplace, trim
protected static org.apache.log4j.Logger logger
protected static final float DEFAULT_GAUSS_TRUNCATE
public float[][] pixels
public FImage(float[] array, int width, int height)
FImage
from an array of floating point values with the
given width and height. The length of the array must equal the width
multiplied by the height.array
- An array of floating point values.width
- The width of the resulting image.height
- The height of th resulting image.public FImage(double[] array, int width, int height)
FImage
from an array of double values with the given
width and height. The length of the array must equal the width multiplied
by the height. The values will be downcast to floats.array
- An array of floating point values.width
- The width of the resulting image.height
- The height of th resulting image.public FImage(double[] array, int width, int height, int offset)
FImage
from an array of double values with the given
width and height. The length of the array must equal the width multiplied
by the height. The values will be downcast to floats.array
- An array of floating point values.width
- The width of the resulting image.height
- The height of the resulting image.offset
- The offset in the array to begin reading frompublic FImage(float[][] array)
FImage
from an array of floating point values.array
- the array representing pixel values to copy data from.public FImage(int width, int height)
FImage
of the given size.width
- image width (number of columns)height
- image height (number of rows)public FImage(int[] data, int width, int height)
FImage
from an array of packed ARGB integers.data
- array of packed ARGB pixelswidth
- the image widthheight
- the image heightpublic FImage abs()
abs
in class Image<Float,FImage>
Image.abs()
public FImage add(FImage im)
FImage
to the pixels of this
image. Returns a new FImage
and does not affect this image or the
given image. This is a version of Image.add(Image)
which takes an
FImage
. This method directly accesses the underlying float[][]
and is therefore fast. This function returns a new FImage
.im
- FImage
to add into this one.FImage
Image.add(Image)
public FImage add(Float num)
FImage
that contains the pixels of this image
increased by the given value. Add a value to each pixel and return new image.add
in class Image<Float,FImage>
num
- The value to add to each pixelImage.add(java.lang.Object)
public FImage add(Image<?,?> im)
UnsupportedOperationException
if the given image is not an FImage
.add
in class Image<Float,FImage>
im
- The image to addFImage
UnsupportedOperationException
- if an unsupported type is addedImage.add(org.openimaj.image.Image)
public FImage addInplace(FImage im)
Image.addInplace(Image)
which takes an FImage
.
This directly accesses the underlying float[][] and is therefore fast.
This function side-affects the pixels in this FImage
.im
- the FImage to addImage.addInplace(Image)
public FImage addInplace(Float num)
addInplace
in class Image<Float,FImage>
num
- The value to add to every pixel in this image.Image.addInplace(java.lang.Object)
public FImage addInplace(Image<?,?> im)
UnsupportedOperationException
if the given image is not an FImage
.addInplace
in class Image<Float,FImage>
im
- The image to add to this imageFImage
UnsupportedOperationException
- if an unsupported type is addedImage.addInplace(org.openimaj.image.Image)
public FImage clip(Float min, Float 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<Float,FImage>
min
- The minimum valuemax
- The maximum valueImage.clip(java.lang.Object, java.lang.Object)
public FImage clipMax(Float thresh)
clipMax
in class Image<Float,FImage>
thresh
- The value over which pixels are clipped to zero.Image.clipMax(java.lang.Object)
public FImage clipMin(Float thresh)
clipMin
in class Image<Float,FImage>
thresh
- The value below which pixels are clipped to zero.Image.clipMin(java.lang.Object)
public FImage clone()
clone
in class SingleBandImage<Float,FImage>
SingleBandImage.clone()
public FImageRenderer createRenderer()
Image
ImageRenderer
capable of drawing into this image.createRenderer
in class Image<Float,FImage>
public FImageRenderer createRenderer(RenderHints options)
Image
ImageRenderer
capable of drawing into this image.createRenderer
in class Image<Float,FImage>
options
- Options for the rendererpublic FImage divide(FImage im)
Image.divide(Image)
which takes an
FImage
. This directly accesses the underlying float[][] and is
therefore fast. This function returns a new FImage
.im
- the FImage
to be the denominator.FImage
Image.divide(Image)
public FImage divideInplace(FImage im)
Image.divideInplace(Image)
which
takes an FImage
. This directly accesses the underlying float[][]
and is therefore fast. This function side-affects this image.im
- the FImage
to be the denominatorFImage
Image.divideInplace(Image)
public FImage divideInplace(Float val)
divideInplace
in class Image<Float,FImage>
val
- The value to divide each pixel by.Image.divideInplace(java.lang.Object)
public FImage divideInplace(float fval)
fval
- the valueImage.divideInplace(java.lang.Object)
public FImage divideInplace(Image<?,?> im)
divideInplace
in class Image<Float,FImage>
im
- image The image to divide this image by.Image.divideInplace(org.openimaj.image.Image)
public FImage extractROI(int x, int y, FImage 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<Float,FImage>
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 FImage extractROI(int x, int y, int w, int h)
(0,0)
is the top-left corner. Returns a new
image.extractROI
in class Image<Float,FImage>
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 FImage fill(Float colour)
fill
in class SingleBandImage<Float,FImage>
colour
- the colour to fill the image withSingleBandImage.fill(java.lang.Comparable)
public FImage fill(float colour)
colour
- the colourSingleBandImage.fill(java.lang.Comparable)
public Rectangle getContentArea()
Image.trim()
.getContentArea
in class Image<Float,FImage>
Image.getContentArea()
public double[] getDoublePixelVector()
public FImage getField(Image.Field f)
getField
in class Image<Float,FImage>
f
- The Image.Field
to extract from this imageImage.getField(org.openimaj.image.Image.Field)
public FImage getFieldCopy(Image.Field f)
getFieldCopy
in class Image<Float,FImage>
f
- The Image.Field
to extract from this imageImage.getFieldCopy(org.openimaj.image.Image.Field)
public FImage getFieldInterpolate(Image.Field f)
getFieldInterpolate
in class Image<Float,FImage>
f
- The Image.Field
to extract from this image.Image.getFieldInterpolate(org.openimaj.image.Image.Field)
public float[] getFloatPixelVector()
public Float getPixel(int x, int y)
(x, y)
.getPixel
in class Image<Float,FImage>
x
- The x-ordinate to gety
- The y-ordinate to getImage.getPixel(int, int)
public Comparator<? super Float> getPixelComparator()
getPixelComparator
in class Image<Float,FImage>
Comparator
that compares pixels.Image.getPixelComparator()
public Float getPixelInterp(double x, double y)
getPixelInterp
in class Image<Float,FImage>
x
- The x-ordinate to gety
- The y-ordinate to get(x,y)
Image.getPixelInterp(double, double)
,
Interpolation.bilerp(double, double, double, double, double, double)
public Float getPixelInterp(double x, double y, Float background)
getPixelInterp
in class Image<Float,FImage>
x
- The x-ordinate to get.y
- The y-ordinate to get.background
- The colour of the background pixel.(x,y)
Image.getPixelInterp(double, double)
,
Interpolation.bilerp(double, double, double, double, double, double)
public float getPixelInterpNative(float x, float y, float background)
x
- the x-ordinatey
- the y-ordinatebackground
- the background colourImage.getPixelInterp(double, double)
,
Interpolation.bilerp(double, double, double, double, double, double)
public FImage internalCopy(FImage im)
internalCopy
in class Image<Float,FImage>
im
- The source image to make a copy of.Image.internalAssign(org.openimaj.image.Image)
public FImage internalAssign(FImage im)
internalAssign
in class Image<Float,FImage>
im
- The source image to make a copy of.Image.internalAssign(org.openimaj.image.Image)
public FImage internalAssign(int[] data, int width, int height)
internalAssign
in class Image<Float,FImage>
data
- buffer of ARGB packed integer pixelswidth
- the width of the bufferheight
- the height of the bufferImage.internalAssign(int [] data, int width, int
height)
public FImage inverse()
inverse
in class Image<Float,FImage>
Image.inverse()
public Float max()
max
in class Image<Float,FImage>
Image.max()
public FValuePixel maxPixel()
FValuePixel
which contains the location and value of the pixel. If there are multiple
pixels with the same value then the first is returned. Note that this
method assumes all pixel values are greater than 0.FValuePixel
.public Float min()
min
in class Image<Float,FImage>
Image.min()
public FValuePixel minPixel()
FValuePixel
which contains the location and value of the pixel. If there are multiple
pixels with the same value then the first is returned. Note that this
method assumes all pixel values are greater than 0.FValuePixel
.public FImage multiply(Float num)
multiply
in class Image<Float,FImage>
num
- The scalar which to multiply the image byImage.multiply(java.lang.Object)
public FImage multiplyInplace(FImage im)
Image.multiplyInplace(Image)
which takes an FImage
. This
directly accesses the underlying float[][] and is therefore fast. This
function works inplace.im
- the FImage
to multiply with this imageImage.multiplyInplace(Image)
public FImage multiplyInplace(Float num)
multiplyInplace
in class Image<Float,FImage>
num
- The scalar to multiply this image by.Image.multiplyInplace(java.lang.Object)
public FImage multiplyInplace(float fnum)
fnum
- the valueImage.multiplyInplace(java.lang.Object)
public FImage multiplyInplace(Image<?,?> im)
UnsupportedOperationException
if the input input is not an
FImage
.multiplyInplace
in class Image<Float,FImage>
im
- The image to multiply with this image.UnsupportedOperationException
- if the given image is not an FImage
Image.multiplyInplace(org.openimaj.image.Image)
public FImage newInstance(int width, int height)
newInstance
in class Image<Float,FImage>
width
- The image widthheight
- The image heightFImage
Image.newInstance(int, int)
public FImage normalise()
normalise
in class Image<Float,FImage>
Image.normalise()
public FImage process(KernelProcessor<Float,FImage> p)
KernelProcessor
and return new
image containing the result.process
in class SingleBandImage<Float,FImage>
p
- The KernelProcessor
to apply.SingleBandImage.process(org.openimaj.image.processor.KernelProcessor)
public FImage process(KernelProcessor<Float,FImage> p, boolean pad)
KernelProcessor
and return new
image containing the result. This method has been overridden in FImage
for
performance.process
in class SingleBandImage<Float,FImage>
p
- The KernelProcessor
to apply.pad
- Should the image be zero padded so the kernel reaches the
edges of the outputSingleBandImage.process(org.openimaj.image.processor.KernelProcessor,
boolean)
public FImage processInplace(PixelProcessor<Float> p)
PixelProcessor
side-affecting
this image. This method has been overridden in FImage
for
performance.processInplace
in class Image<Float,FImage>
p
- The PixelProcessor
to apply.Image.processInplace(org.openimaj.image.processor.PixelProcessor)
public void analyseWith(PixelAnalyser<Float> p)
PixelAnalyser
. This method has been overridden in FImage
for
performance.analyseWith
in class Image<Float,FImage>
p
- The analyser to analyse with.Image.analyseWith(org.openimaj.image.analyser.PixelAnalyser)
public void setPixel(int x, int y, Float val)
(x,y)
to the given value. Side-affects
this image.setPixel
in class Image<Float,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)
public FImage subtract(FImage im)
FImage
from this image returning a new image
containing the result.im
- The image to subtract from this image.public FImage subtract(Float num)
subtract
in class Image<Float,FImage>
num
- A value to subtract from each pixel.Image.subtract(java.lang.Object)
public FImage subtract(Image<?,?> input)
UnsupportedOperationException
if the
given image is not an FImage
.subtract
in class Image<Float,FImage>
input
- The image to subtract from this image.UnsupportedOperationException
- if the given image is not an FImage
.Image.subtract(org.openimaj.image.Image)
public FImage subtractInplace(FImage im)
FImage
from this image.
Side-affects this image.im
- The FImage
to subtract from this image.public FImage subtractInplace(Float num)
subtractInplace
in class Image<Float,FImage>
num
- A value to subtract from each pixel.Image.subtractInplace(java.lang.Object)
public FImage subtractInplace(Image<?,?> im)
subtractInplace
in class Image<Float,FImage>
im
- The image to subtract from this image.Image.subtractInplace(org.openimaj.image.Image)
public FImage threshold(Float thresh)
threshold
in class Image<Float,FImage>
thresh
- The threshold valueImage.threshold(java.lang.Object)
public byte[] toByteImage()
toByteImage
in class Image<Float,FImage>
Image.toByteImage()
public int[] toPackedARGBPixels()
toPackedARGBPixels
in class Image<Float,FImage>
Image.toPackedARGBPixels()
public String toString()
toString
in class Object
Object.toString()
public String toString(String format)
String.format(String, Object...)
) to format
each pixel value.format
- The format string to use for each pixel outputString.format(String, Object...)
public FImage transform(Jama.Matrix transform)
transform
in class Image<Float,FImage>
transform
- The transform matrix to apply.Image.transform(Jama.Matrix)
public FImage zero()
zero
in class Image<Float,FImage>
Image.zero()
public boolean equalsThresh(FImage o, float thresh)
o
- the image to compare againstthresh
- the threshold for determining equalitypublic 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 static FImage[] createArray(int num, int width, int height)
num
- array lengthwidth
- width of imagesheight
- height of imagespublic float sum()
public FImage flipX()
Image
public FImage flipY()
Image
public FImage overlayInplace(FImage img, FImage alpha, int x, int y)
img
- The image to overlayalpha
- The alpha channel to usex
- The location to draw the imagey
- The location to draw the imagepublic FImage overlayInplace(FImage image, int x, int y)
This method will overlay the given image at the given location with full opacity.
overlayInplace
in class Image<Float,FImage>
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 FImage randomImage(int width, int height)
width
- the widthheight
- the heightpublic FImage replace(Float target, Float replacement)
Image
public FImage replace(float target, float replacement)
target
- the colour to fill the image withreplacement
- the colour to fill the image withpublic FImage extractCentreSubPix(float cx, float cy, FImage 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<Float,FImage>
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)