Q - the pixel typeI - the actual image of the concrete subclasspublic abstract class Image<Q,I extends Image<Q,I>> extends Object implements Cloneable, Serializable, ImageProvider<I>
| Modifier and Type | Class and Description |
|---|---|
static class |
Image.Field
Enumerator for representing the type of field interlacing operations.
|
| Constructor and Description |
|---|
Image() |
| Modifier and Type | Method and Description |
|---|---|
abstract I |
abs()
Set all pixels to their absolute values, so that all pixel values in the
image will be greater than zero.
|
void |
accumulateWith(AccumulatingImageCombiner<I,?> combiner)
Accumulate this image the the given
AccumulatingImageCombiner. |
I |
add(Image<?,?> im)
Adds the given image to this image and return new image.
|
I |
add(Q num)
Add a value to each pixel and return new image.
|
abstract I |
addInplace(Image<?,?> im)
Add the given image to this image (side-affects this image).
|
abstract I |
addInplace(Q num)
Add a scalar to each pixel in this image (side-affects this image).
|
void |
analyseWith(ImageAnalyser<I> analyser)
Analyse this image with an
ImageAnalyser. |
void |
analyseWith(PixelAnalyser<Q> analyser)
Analyse this image with a
PixelAnalyser. |
void |
analyseWithMasked(FImage mask,
PixelAnalyser<Q> analyser)
Analyse this image with the given
PixelAnalyser, only analysing
those pixels where the mask is non-zero. |
abstract I |
clip(Q min,
Q 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). |
abstract I |
clipMax(Q thresh)
Set all values greater than the given value to the highest normal value
that the image allows (usually 1 for floating-point images).
|
abstract I |
clipMin(Q thresh)
Set all values less than the given value to zero.
|
abstract I |
clone()
Deep copy of an image (internal image buffers copied).
|
<OUT extends Image<?,OUT>,OTHER extends Image<?,OTHER>> |
combineWith(ImageCombiner<I,OTHER,OUT> combiner,
OTHER other)
Combine this image with another using an
ImageCombiner. |
abstract ImageRenderer<Q,I> |
createRenderer()
Create a
ImageRenderer capable of drawing into this image. |
abstract ImageRenderer<Q,I> |
createRenderer(RenderHints options)
Create a
ImageRenderer capable of drawing into this image. |
Q |
defaultBackgroundColour()
Get the default foreground colour.
|
Q |
defaultForegroundColour()
Get the default foreground colour.
|
I |
divide(Image<?,?> im)
Divide each pixel of the image by corresponding pixel in the given image.
|
I |
divide(Q val)
Divide each pixel of the image by the given scalar value.
|
abstract I |
divideInplace(Image<?,?> im)
Divide each pixel in this image by the corresponding pixel value in the
given image.
|
abstract I |
divideInplace(Q val)
Divide each pixel of the image by the given scalar value.
|
void |
drawConnectedPoints(List<? extends Point2d> pts,
Q col)
Draw onto this image lines drawn with the given colour between the points
given.
|
Point2d[] |
drawCubicBezier(Point2d p1,
Point2d p2,
Point2d c1,
Point2d c2,
int thickness,
Q col)
Draw a cubic Bezier curve into the image with 100 point accuracy.
|
void |
drawImage(I image,
int x,
int y)
Draw into this image the provided image at the given coordinates.
|
void |
drawImage(I image,
int x,
int y,
Q... ignoreList)
Draw into this image the provided image at the given coordinates ignoring
certain pixels.
|
void |
drawImage(I image,
Point2d pt)
Draw into this image the provided image at the given coordinates.
|
void |
drawLine(int x1,
int y1,
double theta,
int length,
int thickness,
Q col)
Draw a line from the coordinates specified by
(x1,y1) at an
angle of theta with the given length, thickness and colour. |
void |
drawLine(int x1,
int y1,
double theta,
int length,
Q col)
Draw a line from the coordinates specified by
(x1,y1) at an
angle of theta with the given length and colour. |
void |
drawLine(int x0,
int y0,
int x1,
int y1,
int thickness,
Q col)
Draw a line from the coordinates specified by
(x0,y0) to the
coordinates specified by (x1,y1) using the given color and
thickness. |
void |
drawLine(int x0,
int y0,
int x1,
int y1,
Q col)
Draw a line from the coordinates specified by
(x0,y0) to
(x1,y1) using the given colour. |
void |
drawLine(Path2d line,
int thickness,
Q col)
Draw a line from the specified Path2d object
|
void |
drawLine(Point2d p1,
Point2d p2,
int thickness,
Q col)
Draw a line from the coordinates specified using the given colour and
thickness.
|
void |
drawLine(Point2d p1,
Point2d p2,
Q col)
Draw a line from the coordinates specified using the given colour.
|
void |
drawLines(Iterable<? extends Path2d> lines,
int thickness,
Q col)
Draw the given list of lines using
drawLine(Path2d, int, Object)
with the given colour and thickness. |
void |
drawPath(Path2d line,
int thickness,
Q col)
Draw a line from the specified Path2d object
|
void |
drawPaths(Iterable<? extends Path2d> lines,
int thickness,
Q col)
Draw the given list of paths using
drawLine(Path2d, int, Object)
with the given colour and thickness. |
void |
drawPoint(Point2d p,
Q col,
int size)
Draw a dot centered on the given location (rounded to nearest integer
location) at the given size and with the given color.
|
void |
drawPoints(Iterable<? extends Point2d> pts,
Q col,
int size)
Draw the given list of points using
drawPoint(Point2d, Object, int) with the given colour and size. |
void |
drawPolygon(Polygon p,
int thickness,
Q col)
Draw the given polygon in the specified colour with the given thickness
lines.
|
void |
drawPolygon(Polygon p,
Q col)
Draw the given polygon in the specified colour.
|
void |
drawPolygonFilled(Polygon p,
Q col)
Draw the given polygon, filled with the specified colour.
|
void |
drawShape(Shape s,
int thickness,
Q col)
Draw the given shape in the specified colour with the given thickness
lines.
|
void |
drawShape(Shape p,
Q col)
Draw the given shape in the specified colour.
|
void |
drawShapeFilled(Shape s,
Q col)
Draw the given shape, filled with the specified colour.
|
void |
drawText(AttributedString text,
int x,
int y)
Render the text using its attributes.
|
void |
drawText(AttributedString text,
Point2d pt)
Render the text using its attributes.
|
<F extends Font<F>> |
drawText(String text,
int x,
int y,
F f,
int sz)
Render the text in the given font with the default style.
|
<F extends Font<F>> |
drawText(String text,
int x,
int y,
F f,
int sz,
Q col)
Render the text in the given font in the given colour with the default
style.
|
void |
drawText(String text,
int x,
int y,
FontStyle<Q> f)
Render the text with the given
FontStyle. |
<F extends Font<F>> |
drawText(String text,
Point2d pt,
F f,
int sz)
Render the text in the given font with the default style.
|
<F extends Font<F>> |
drawText(String text,
Point2d pt,
F f,
int sz,
Q col)
Render the text in the given font in the given colour with the default
style.
|
void |
drawText(String text,
Point2d pt,
FontStyle<Q> f)
Render the text with the given
FontStyle. |
I |
extractCenter(int w,
int h)
Extract a rectangular region about the centre of the image with the given
width and height.
|
I |
extractCenter(int x,
int y,
int w,
int h)
Extract a rectangular region centred on a given point.
|
abstract 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 |
extractCentreSubPix(float cx,
float cy,
int width,
int height)
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 |
extractCentreSubPix(Point2d centre,
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 |
extractCentreSubPix(Point2d centre,
int width,
int height)
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)
. |
abstract I |
extractROI(int x,
int y,
I img)
Extract a rectangular region of interest from this image and put it in
the given image.
|
abstract I |
extractROI(int x,
int y,
int w,
int h)
Extract a rectangular region of interest of the given width and height.
|
I |
extractROI(Rectangle r)
Extract a rectangular region of interest of the given width and height.
|
abstract I |
fill(Q colour)
Fill this image with the given colour.
|
abstract I |
flipX()
Flips the content horizontally.
|
abstract I |
flipY()
Flips the content vertically.
|
Rectangle |
getBounds()
Get a rectangle representing the image, with the top-left at 0,0 and the
bottom-right at width,height
|
int |
getCols()
Get the image width in pixels.
|
abstract Rectangle |
getContentArea()
Get bounding box of non-zero-valued pixels around the outside of the
image.
|
abstract I |
getField(Image.Field f)
Get the given field of this image.
|
abstract I |
getFieldCopy(Image.Field f)
Get the given field of this image, maintaining the image's aspect ratio
by doubling the fields.
|
abstract I |
getFieldInterpolate(Image.Field f)
Get the given field of this image, maintaining the image's aspect ratio
by interpolating between the fields.
|
abstract int |
getHeight()
Returns the image height in pixels.
|
I |
getImage()
Get the image that this provider provides.
|
abstract Q |
getPixel(int x,
int y)
Get the value of the pixel at coordinate
(x, y). |
Q |
getPixel(Pixel p)
Get the value of the pixel at coordinate p
|
abstract Comparator<? super Q> |
getPixelComparator()
Returns a pixel comparator that is able to compare equality of pixels in
the given image type.
|
abstract Q |
getPixelInterp(double x,
double y)
Get the value of a sub-pixel using linear-interpolation.
|
abstract Q |
getPixelInterp(double x,
double y,
Q backgroundColour)
Get the value of a sub-pixel using linear-interpolation.
|
Q[] |
getPixelVector(Q[] f)
Returns the pixels in this image as a vector (an array of the pixel
type).
|
int |
getRows()
Get the height of this image.
|
abstract int |
getWidth()
Get the width (number of columns) in this image.
|
abstract I |
internalAssign(I im)
Assign the internal state from another image of the same type.
|
abstract I |
internalAssign(int[] pixelData,
int width,
int height)
Copy pixels from given ARGB buffer image into this image.
|
abstract I |
internalCopy(I im)
Copy the internal state from another image of the same type.
|
abstract I |
inverse()
Invert the image pixels by finding the maximum value and subtracting each
pixel value from that maximum.
|
abstract Q |
max()
Find the maximum pixel value.
|
abstract Q |
min()
Find the minimum pixel value.
|
I |
multiply(Image<?,?> im)
Multiply the pixel values in this image with the corresponding pixel
values in the given image.
|
I |
multiply(Q num)
Multiply each pixel of this by the given scalar and return new image.
|
abstract I |
multiplyInplace(Image<?,?> im)
Multiply each pixel in this image by the corresponding pixel in the given
image.
|
abstract I |
multiplyInplace(Q num)
Multiply each pixel of this by the given scalar.
|
abstract I |
newInstance(int width,
int height)
Create a new instance of this image subclass with given dimensions.
|
abstract I |
normalise()
Normalise all pixel values to fall within the range 0.0 - 1.0.
|
I |
overlay(I image,
int x,
int y)
Overlays the given image on this image and returns a new image containing
the result.
|
abstract I |
overlayInplace(I image,
int x,
int y)
Overlays the given image on this image directly.
|
I |
padding(int paddingWidth,
int paddingHeight)
Adds padding as in
padding(int, int, Object). |
I |
padding(int paddingWidth,
int paddingHeight,
Q paddingColour)
Adds this many pixels to both sides of the image such that the new image
width = padding + width + padding with the original image in the middle
|
I |
paddingSymmetric(int paddingLeft,
int paddingRight,
int paddingTop,
int paddingBottom)
Adds pixels to around the image such that the new image width =
paddingLeft + width + paddingRight with the original image in the middle.
|
I |
process(GridProcessor<Q,I> p)
Process this image with the given
GridProcessor and return new
image containing the result. |
I |
process(ImageProcessor<I> p)
Process this image with an
ImageProcessor and return new image
containing the result. |
I |
process(KernelProcessor<Q,I> p)
Process this image with the given
KernelProcessor and return new
image containing the result. |
I |
process(KernelProcessor<Q,I> p,
boolean pad)
Process this image with the given
KernelProcessor and return new
image containing the result. |
I |
process(PixelProcessor<Q> p)
Process this image with the given
PixelProcessor and return a new
image containing the result. |
I |
process(Processor<I> p)
Process this image with an
Processor and return new image
containing the result. |
I |
processInplace(ImageProcessor<I> p)
Process this image with the given
ImageProcessor side-affecting
this image. |
I |
processInplace(KernelProcessor<Q,I> p)
Process this image with the given
KernelProcessor side-affecting
this image. |
I |
processInplace(KernelProcessor<Q,I> p,
boolean pad)
Process this image with the given
KernelProcessor side-affecting
this image. |
I |
processInplace(PixelProcessor<Q> p)
Process this image with the given
PixelProcessor side-affecting
this image. |
I |
processInplace(Processor<I> p)
Process this image with the given
Processor side-affecting this
image. |
I |
processMasked(FImage mask,
PixelProcessor<Q> p)
Process this image with the given
PixelProcessor only affecting
those pixels where the mask is non-zero. |
I |
processMaskedInplace(FImage mask,
PixelProcessor<Q> p)
Process this image with the given
PixelProcessor, only affecting
those pixels where the mask is non-zero. |
abstract I |
replace(Q target,
Q replacement)
Replace pixels of a certain colour with another colour.
|
abstract void |
setPixel(int x,
int y,
Q val)
Sets the pixel at
(x,y) to the given value. |
I |
shiftDown()
Returns a new image that is it shifted around the x-ordinates by one
pixel
|
I |
shiftDown(int nPixels)
Returns a new image that is it shifted around the x-ordinates by the
number of pixels given.
|
I |
shiftDownInplace()
Shifts all the pixels down by one pixels
|
I |
shiftDownInplace(int count)
Shifts all the pixels down by count pixels
|
I |
shiftLeft()
Returns a new image that is it shifted around the x-ordinates by one
pixel
|
I |
shiftLeft(int nPixels)
Returns a new image that is it shifted around the x-ordinates by the
number of pixels given.
|
I |
shiftLeftInplace()
Shifts all the pixels to the left by one pixel
|
I |
shiftLeftInplace(int count)
Shifts all the pixels to the left by count pixel
|
I |
shiftRight()
Returns a new image that is it shifted around the x-ordinates by one
pixel
|
I |
shiftRight(int nPixels)
Returns a new image that is it shifted around the x-ordinates by the
number of pixels given.
|
I |
shiftRightInplace()
Shifts all the pixels to the right by one pixel
|
I |
shiftRightInplace(int count)
Shifts all the pixels to the right by count pixel
|
I |
shiftUp()
Returns a new image that is it shifted around the x-ordinates by one
pixel
|
I |
shiftUp(int nPixels)
Returns a new image that is it shifted around the x-ordinates by the
number of pixels given.
|
I |
shiftUpInplace()
Shifts all the pixels up by one pixel
|
I |
shiftUpInplace(int count)
Shifts all the pixels up by count pixels
|
I |
subtract(Image<?,?> im)
Subtract the corresponding pixel value from the given image from the
pixel values in this image.
|
I |
subtract(Q num)
Subtract a scalar from every pixel value in this image and return new
image.
|
abstract I |
subtractInplace(Image<?,?> im)
Subtract the corresponding pixel value from the given image from the
pixel values in this image.
|
abstract I |
subtractInplace(Q num)
Subtract a scalar from every pixel value in this image.
|
abstract I |
threshold(Q thresh)
Set all values less than the given threshold to 0 and all others to 1.
|
abstract byte[] |
toByteImage()
Convert the image to a byte representation suitable for writing to a pnm
type format.
|
abstract int[] |
toPackedARGBPixels()
Returns a 1D array representation of this image with each pixel
represented as a packed ARGB integer.
|
I |
transform(Jama.Matrix transform)
Apply a transform matrix to the image and returns the result as a new
image.
|
I |
trim()
Removes zero-valued pixels from around the outside of the image.
|
abstract I |
zero()
Set all pixels in the image to zero.
|
public Image()
public void accumulateWith(AccumulatingImageCombiner<I,?> combiner)
AccumulatingImageCombiner.combiner - the combinerAccumulatingImageCombiner.accumulate(Image)public abstract I abs()
public I add(Image<?,?> im)
im - The image to addpublic I add(Q num)
num - The value to add to each pixelpublic abstract I addInplace(Image<?,?> im)
im - The image to add to this imagepublic abstract I addInplace(Q num)
num - The value to add to every pixel in this image.public void analyseWith(ImageAnalyser<I> analyser)
ImageAnalyser.analyser - The analyser to analyse with.ImageAnalyser.analyseImage(Image)public void analyseWith(PixelAnalyser<Q> analyser)
PixelAnalyser.analyser - The analyser to analyse with.PixelAnalyser.analysePixel(Object)public void analyseWithMasked(FImage mask, PixelAnalyser<Q> analyser)
PixelAnalyser, only analysing
those pixels where the mask is non-zero.mask - The mask to apply to the analyser.analyser - The PixelProcessor to apply.PixelAnalyser.analysePixel(Object)public abstract I clip(Q min, Q 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.min - The minimum valuemax - The maximum valuepublic abstract I clipMax(Q thresh)
thresh - The value over which pixels are clipped to zero.public abstract I clipMin(Q thresh)
thresh - The value below which pixels are clipped to zero.public abstract ImageRenderer<Q,I> createRenderer()
ImageRenderer capable of drawing into this image.public abstract ImageRenderer<Q,I> createRenderer(RenderHints options)
ImageRenderer capable of drawing into this image.options - Options for the rendererpublic <OUT extends Image<?,OUT>,OTHER extends Image<?,OTHER>> OUT combineWith(ImageCombiner<I,OTHER,OUT> combiner, OTHER other)
ImageCombiner.public Q defaultBackgroundColour()
This is a convenience method that calls createRenderer() to get
the default renderer to do the actual drawing. Create the renderer
yourself and use it to draw if you need more control.
public Q defaultForegroundColour()
This is a convenience method that calls createRenderer() to get
the default renderer to do the actual drawing. Create the renderer
yourself and use it to draw if you need more control.
public I divide(Image<?,?> im)
im - image The image to divide this image by.public I divide(Q val)
val - The value to divide the pixels in this image by.public abstract I divideInplace(Image<?,?> im)
im - image The image to divide this image by.public abstract I divideInplace(Q val)
val - The value to divide each pixel by.public void drawConnectedPoints(List<? extends Point2d> pts, Q col)
This is a convenience method that calls createRenderer() to get
the default renderer to do the actual drawing. Create the renderer
yourself and use it to draw if you need more control.
pts - The point list to draw onto this image.col - The colour to draw the linespublic Point2d[] drawCubicBezier(Point2d p1, Point2d p2, Point2d c1, Point2d c2, int thickness, Q col)
This is a convenience method that calls createRenderer() to get
the default renderer to do the actual drawing. Create the renderer
yourself and use it to draw if you need more control.
p1 - One end point of the linep2 - The other end point of the linec1 - The control point associated with p1c2 - The control point associated with p2thickness - The thickness to draw the linecol - The colour to draw the linepublic void drawImage(I image, int x, int y)
This is a convenience method that calls createRenderer() to get
the default renderer to do the actual drawing. Create the renderer
yourself and use it to draw if you need more control.
image - The image to draw.x - The x-ordinate of the top-left of the imagey - The y-ordinate of the top-left of the imagepublic void drawImage(I image, Point2d pt)
This is a convenience method that calls createRenderer() to get
the default renderer to do the actual drawing. Create the renderer
yourself and use it to draw if you need more control.
image - The image to draw.pt - the coordinate at which to drawpublic void drawImage(I image, int x, int y, Q... ignoreList)
This is a convenience method that calls createRenderer() to get
the default renderer to do the actual drawing. Create the renderer
yourself and use it to draw if you need more control.
image - The image to draw.x - The x-ordinate of the top-left of the imagey - The y-ordinate of the top-left of the imageignoreList - The list of pixels to ignore when copying the imagepublic void drawLine(int x1, int y1, double theta, int length, int thickness, Q col)
(x1,y1) at an
angle of theta with the given length, thickness and colour.
Side-affects this image.
This is a convenience method that calls createRenderer() to get
the default renderer to do the actual drawing. Create the renderer
yourself and use it to draw if you need more control.
x1 - The x-ordinate to start the line.y1 - The y-ordinate to start the line.theta - The angle at which to draw the line.length - The length to draw the line.thickness - The thickness to draw the line.col - The colour to draw the line.public void drawLine(int x1, int y1, double theta, int length, Q col)
(x1,y1) at an
angle of theta with the given length and colour.
Line-thickness will be 1. Side-affects this image.
This is a convenience method that calls createRenderer() to get
the default renderer to do the actual drawing. Create the renderer
yourself and use it to draw if you need more control.
x1 - The x-ordinate to start the line.y1 - The y-ordinate to start the line.theta - The angle at which to draw the line.length - The length to draw the line.col - The colour to draw the line.public void drawLine(int x0, int y0, int x1, int y1, int thickness, Q col)
(x0,y0) to the
coordinates specified by (x1,y1) using the given color and
thickness. Side-affects this image.
This is a convenience method that calls createRenderer() to get
the default renderer to do the actual drawing. Create the renderer
yourself and use it to draw if you need more control.
x0 - The x-ordinate at the start of the line.y0 - The y-ordinate at the start of the line.x1 - The x-ordinate at the end of the line.y1 - The y-ordinate at the end of the line.thickness - The thickness which to draw the line.col - The colour in which to draw the line.public void drawLine(int x0, int y0, int x1, int y1, Q col)
(x0,y0) to
(x1,y1) using the given colour. The line thickness will be 1
pixel. Side-affects this image.
This is a convenience method that calls createRenderer() to get
the default renderer to do the actual drawing. Create the renderer
yourself and use it to draw if you need more control.
x0 - The x-ordinate at the start of the line.y0 - The y-ordinate at the start of the line.x1 - The x-ordinate at the end of the line.y1 - The y-ordinate at the end of the line.col - The colour in which to draw the line.public void drawLine(Point2d p1, Point2d p2, Q col)
This is a convenience method that calls createRenderer() to get
the default renderer to do the actual drawing. Create the renderer
yourself and use it to draw if you need more control.
p1 - The coordinate of the start of the line.p2 - The coordinate of the end of the line.col - The colour in which to draw the line.public void drawLine(Point2d p1, Point2d p2, int thickness, Q col)
This is a convenience method that calls createRenderer() to get
the default renderer to do the actual drawing. Create the renderer
yourself and use it to draw if you need more control.
p1 - The coordinate of the start of the line.p2 - The coordinate of the end of the line.thickness - the stroke widthcol - The colour in which to draw the line.public void drawLine(Path2d line, int thickness, Q col)
This is a convenience method that calls createRenderer() to get
the default renderer to do the actual drawing. Create the renderer
yourself and use it to draw if you need more control.
line - the linethickness - the stroke widthcol - The colour in which to draw the line.public void drawPath(Path2d line, int thickness, Q col)
This is a convenience method that calls createRenderer() to get
the default renderer to do the actual drawing. Create the renderer
yourself and use it to draw if you need more control.
line - the linethickness - the stroke widthcol - The colour in which to draw the line.public void drawLines(Iterable<? extends Path2d> lines, int thickness, Q col)
drawLine(Path2d, int, Object)
with the given colour and thickness. Side-affects this image.
This is a convenience method that calls createRenderer() to get
the default renderer to do the actual drawing. Create the renderer
yourself and use it to draw if you need more control.
lines - The list of lines to draw.thickness - the stroke widthcol - The colour to draw each point.public void drawPaths(Iterable<? extends Path2d> lines, int thickness, Q col)
drawLine(Path2d, int, Object)
with the given colour and thickness. Side-affects this image.
This is a convenience method that calls createRenderer() to get
the default renderer to do the actual drawing. Create the renderer
yourself and use it to draw if you need more control.
lines - The list of lines to draw.thickness - the stroke widthcol - The colour to draw each point.public void drawPoint(Point2d p, Q col, int size)
This is a convenience method that calls createRenderer() to get
the default renderer to do the actual drawing. Create the renderer
yourself and use it to draw if you need more control.
p - The coordinates at which to draw the pointcol - The colour to draw the pointsize - The size at which to draw the point.public void drawPoints(Iterable<? extends Point2d> pts, Q col, int size)
drawPoint(Point2d, Object, int) with the given colour and size.
Side-affects this image.
This is a convenience method that calls createRenderer() to get
the default renderer to do the actual drawing. Create the renderer
yourself and use it to draw if you need more control.
pts - The list of points to draw.col - The colour to draw each point.size - The size to draw each point.public void drawPolygon(Polygon p, int thickness, Q col)
This is a convenience method that calls createRenderer() to get
the default renderer to do the actual drawing. Create the renderer
yourself and use it to draw if you need more control.
p - The polygon to draw.thickness - The thickness of the lines to usecol - The colour to draw the lines inpublic void drawPolygon(Polygon p, Q col)
drawPolygon(Polygon, int, Object) with line thickness 1.
Side-affects this image.
This is a convenience method that calls createRenderer() to get
the default renderer to do the actual drawing. Create the renderer
yourself and use it to draw if you need more control.
p - The polygon to draw.col - The colour to draw the polygon in.public void drawPolygonFilled(Polygon p, Q col)
This is a convenience method that calls createRenderer() to get
the default renderer to do the actual drawing. Create the renderer
yourself and use it to draw if you need more control.
p - The polygon to draw.col - The colour to fill the polygon with.public void drawShape(Shape s, int thickness, Q col)
This is a convenience method that calls createRenderer() to get
the default renderer to do the actual drawing. Create the renderer
yourself and use it to draw if you need more control.
s - The shape to draw.thickness - The thickness of the lines to usecol - The colour to draw the lines inpublic void drawShape(Shape p, Q col)
drawPolygon(Polygon, int, Object) with line thickness 1.
Side-affects this image.
This is a convenience method that calls createRenderer() to get
the default renderer to do the actual drawing. Create the renderer
yourself and use it to draw if you need more control.
p - The shape to draw.col - The colour to draw the polygon in.public void drawShapeFilled(Shape s, Q col)
This is a convenience method that calls createRenderer() to get
the default renderer to do the actual drawing. Create the renderer
yourself and use it to draw if you need more control.
s - The shape to draw.col - The colour to fill the polygon with.public void drawText(AttributedString text, int x, int y)
This is a convenience method that calls createRenderer() to get
the default renderer to do the actual drawing. Create the renderer
yourself and use it to draw if you need more control.
text - the textx - the x-ordinatey - the y-ordinatepublic void drawText(AttributedString text, Point2d pt)
This is a convenience method that calls createRenderer() to get
the default renderer to do the actual drawing. Create the renderer
yourself and use it to draw if you need more control.
text - the textpt - the coordinate to render atpublic <F extends Font<F>> void drawText(String text, int x, int y, F f, int sz)
This is a convenience method that calls createRenderer() to get
the default renderer to do the actual drawing. Create the renderer
yourself and use it to draw if you need more control.
F - the fonttext - the textx - the x-ordinatey - the y-ordinatef - the fontsz - the sizepublic <F extends Font<F>> void drawText(String text, int x, int y, F f, int sz, Q col)
This is a convenience method that calls createRenderer() to get
the default renderer to do the actual drawing. Create the renderer
yourself and use it to draw if you need more control.
F - the fonttext - the textx - the x-ordinatey - the y-ordinatef - the fontsz - the sizecol - the font colorpublic void drawText(String text, int x, int y, FontStyle<Q> f)
FontStyle.
This is a convenience method that calls createRenderer() to get
the default renderer to do the actual drawing. Create the renderer
yourself and use it to draw if you need more control.
text - the textx - the x-ordinatey - the y-ordinatef - the font stylepublic <F extends Font<F>> void drawText(String text, Point2d pt, F f, int sz)
This is a convenience method that calls createRenderer() to get
the default renderer to do the actual drawing. Create the renderer
yourself and use it to draw if you need more control.
F - the fonttext - the textpt - the coordinate to render atf - the fontsz - the sizepublic <F extends Font<F>> void drawText(String text, Point2d pt, F f, int sz, Q col)
This is a convenience method that calls createRenderer() to get
the default renderer to do the actual drawing. Create the renderer
yourself and use it to draw if you need more control.
F - the fonttext - the textpt - the coordinate to render atf - the fontsz - the sizecol - the font colourpublic void drawText(String text, Point2d pt, FontStyle<Q> f)
FontStyle.
This is a convenience method that calls createRenderer() to get
the default renderer to do the actual drawing. Create the renderer
yourself and use it to draw if you need more control.
text - the textpt - the coordinate to render atf - the font stylepublic I extractCenter(int w, int h)
width/2 and height/2 from the centre point so
that the centre point of the extracted box is also the centre point of
the image.w - The width of the box to extracth - The height of the box to extractpublic I extractCenter(int x, int y, int w, int h)
width/2 and height/2
from the given point (x,y) such that the centre point of the
extracted box is the same as the point (x,y) in this image.x - Center point of the rectangle to extracty - center point of the rectangle to extractw - The width of the rectangle to extracth - The height of the rectangle to extractpublic abstract I extractROI(int x, int y, I img)
(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.x - The leftmost coordinate of the rectangle to extracty - The topmost coordinate of the rectangle to extractimg - The destination imagepublic abstract I extractROI(int x, int y, int w, int h)
(0,0) is the top-left corner. Returns a new
image.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 extractpublic I extractROI(Rectangle r)
(0,0) is the top-left corner. Returns a new
image.r - the rectanglepublic abstract I fill(Q colour)
colour - the colour to fill the image withpublic abstract I flipX()
public abstract I flipY()
public Rectangle getBounds()
public int getCols()
getWidth();public abstract Rectangle getContentArea()
trim().public abstract I getField(Image.Field f)
f - The Image.Field to extract from this imagepublic abstract I getFieldCopy(Image.Field f)
f - The Image.Field to extract from this imagepublic abstract I getFieldInterpolate(Image.Field f)
f - The Image.Field to extract from this image.public abstract int getHeight()
public abstract Q getPixel(int x, int y)
(x, y).x - The x-ordinate to gety - The y-ordinate to getpublic Q getPixel(Pixel p)
p - The coordinate to getpublic abstract Comparator<? super Q> getPixelComparator()
Comparator that compares pixels.public abstract Q getPixelInterp(double x, double y)
x - The x-ordinate to gety - The y-ordinate to get(x,y)public abstract Q getPixelInterp(double x, double y, Q backgroundColour)
x - The x-ordinate to get.y - The y-ordinate to get.backgroundColour - The colour of the background pixel.(x,y)public Q[] getPixelVector(Q[] f)
f - The array into which to place the datapublic int getRows()
getHeight().public abstract int getWidth()
public abstract I internalCopy(I im)
im - The source image to make a copy of.public abstract I internalAssign(I im)
im - The source image to make a copy of.public abstract I internalAssign(int[] pixelData, int width, int height)
pixelData - buffer of ARGB packed integer pixelswidth - the width of the bufferheight - the height of the bufferpublic abstract I inverse()
public I multiply(Image<?,?> im)
im - The image to multiply with this onepublic I multiply(Q num)
num - The scalar which to multiply the image bypublic abstract I multiplyInplace(Image<?,?> im)
im - The image to multiply with this image.public abstract I multiplyInplace(Q num)
num - The scalar to multiply this image by.public abstract I newInstance(int width, int height)
width - The image widthheight - The image heightIpublic abstract I normalise()
public I padding(int paddingWidth, int paddingHeight)
padding(int, int, Object). The padding
colour is the colour of the closest border pixel.paddingWidth - padding in the x directionpaddingHeight - padding in the y directionpublic I padding(int paddingWidth, int paddingHeight, Q paddingColour)
paddingWidth - left and right padding widthpaddingHeight - top and bottom padding widthpaddingColour - colour of padding, if null the closes border pixel is usedpublic I paddingSymmetric(int paddingLeft, int paddingRight, int paddingTop, int paddingBottom)
paddingLeft - left padding widthpaddingRight - right padding widthpaddingTop - top padding widthpaddingBottom - bottom padding widthpublic I process(GridProcessor<Q,I> p)
GridProcessor and return new
image containing the result.p - GridProcessor to apply to this image.public I process(ImageProcessor<I> p)
ImageProcessor and return new image
containing the result.p - The ImageProcessor to apply to this image.public I process(KernelProcessor<Q,I> p)
KernelProcessor and return new
image containing the result.p - The KernelProcessor to apply.public I process(KernelProcessor<Q,I> p, boolean pad)
KernelProcessor and return new
image containing the result.p - The KernelProcessor to apply.pad - Should the image be zero padded so the kernel reaches the
edges of the outputpublic I process(PixelProcessor<Q> p)
PixelProcessor and return a new
image containing the result.p - The PixelProcessor to apply.public I process(Processor<I> p)
Processor and return new image
containing the result.p - The Processor to apply to this image.public I processInplace(Processor<I> p)
Processor side-affecting this
image.p - The Processor to apply.public I processInplace(ImageProcessor<I> p)
ImageProcessor side-affecting
this image.p - The ImageProcessor to apply.public I processInplace(KernelProcessor<Q,I> p)
KernelProcessor side-affecting
this image.p - The KernelProcessor to apply.public I processInplace(KernelProcessor<Q,I> p, boolean pad)
KernelProcessor side-affecting
this image.p - The KernelProcessor to apply.pad - Should the image be zero padded so the kernel reaches the
edges of the outputpublic I processInplace(PixelProcessor<Q> p)
PixelProcessor side-affecting
this image.p - The PixelProcessor to apply.public I processMasked(FImage mask, PixelProcessor<Q> p)
PixelProcessor only affecting
those pixels where the mask is non-zero. Returns a new image.mask - The mask to apply to the processing.p - The PixelProcessor to apply.public I processMaskedInplace(FImage mask, PixelProcessor<Q> p)
PixelProcessor, only affecting
those pixels where the mask is non-zero. Side-affects this image.mask - The mask to apply to the processor.p - The PixelProcessor to apply.public abstract void setPixel(int x, int y, Q val)
(x,y) to the given value. Side-affects
this image.x - The x-ordinate of the pixel to sety - The y-ordinate of the pixel to setval - The value to set the pixel to.public I subtract(Image<?,?> im)
im - The image to subtract from this image.public I subtract(Q num)
num - A value to subtract from each pixel.public abstract I subtractInplace(Image<?,?> im)
im - The image to subtract from this image.public abstract I subtractInplace(Q num)
num - A value to subtract from each pixel.public abstract I threshold(Q thresh)
thresh - The threshold valuepublic abstract byte[] toByteImage()
public abstract int[] toPackedARGBPixels()
public I transform(Jama.Matrix transform)
transform - The transform matrix to apply.public I trim()
String.trim().public abstract I zero()
public I shiftLeftInplace()
public I shiftRightInplace()
public I shiftLeftInplace(int count)
count - The number of pixelspublic I shiftRightInplace(int count)
count - The number of pixelspublic I shiftLeft()
public I shiftLeft(int nPixels)
nPixels - The number of pixelspublic I shiftRight()
public I shiftRight(int nPixels)
nPixels - the number of pixelspublic I shiftUpInplace()
public I shiftDownInplace()
public I shiftUpInplace(int count)
count - The number of pixelspublic I shiftDownInplace(int count)
count - The number of pixelspublic I shiftUp()
public I shiftUp(int nPixels)
nPixels - The number of pixelspublic I shiftDown()
public I shiftDown(int nPixels)
nPixels - the number of pixelspublic I overlay(I image, int x, int y)
image - The image to overlay on this image.x - The location at which to overlay the imagey - The location at which to overlay the imagepublic abstract I overlayInplace(I image, int x, int y)
image - The image to overlayx - The location at which to overlay the imagey - The location at which to overlay the imagepublic I getImage()
ImageProviderpublic abstract I replace(Q target, Q replacement)
target - the colour to fill the image withreplacement - the colour to fill the image withpublic I extractCentreSubPix(Point2d centre, int width, int height)
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.centre - the centrewidth - the region widthheight - the region heightgetPixelInterp(double, double)public I extractCentreSubPix(float cx, float cy, int width, int height)
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.cx - the x-ordinate of the centrecy - the y-ordinate of the centrewidth - the region widthheight - the region heightgetPixelInterp(double, double)public I extractCentreSubPix(Point2d centre, I out)
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.centre - the centreout - the output image (also defines the size of the extracted
region)outgetPixelInterp(double, double)public abstract I extractCentreSubPix(float cx, float cy, I out)
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.cx - the x-ordinate of the centrecy - the y-ordinate of the centreout - the output image (also defines the size of the extracted
region)outgetPixelInterp(double, double)