public class KernelFactory extends Object
KernelJAI objects).| Modifier and Type | Class and Description |
|---|---|
static class |
KernelFactory.ValueType
Constants specifying how kernel element values are calculated.
|
| Constructor and Description |
|---|
KernelFactory() |
| Modifier and Type | Method and Description |
|---|---|
static javax.media.jai.KernelJAI |
createAnnulus(int outerRadius,
int innerRadius,
KernelFactory.ValueType type)
Creates an annular kernel (a doughnut).
|
static javax.media.jai.KernelJAI |
createAnnulus(int outerRadius,
int innerRadius,
KernelFactory.ValueType type,
float centreValue)
Deprecated.
Please use
createAnnulus(int, int, ValueType) instead and
set the centre element value on the returned kernel if that is
required. |
static javax.media.jai.KernelJAI |
createCircle(int radius)
Create a circular kernel where all elements within the circle
have value 1.0 while those outside have value 0.0.
|
static javax.media.jai.KernelJAI |
createCircle(int radius,
KernelFactory.ValueType type)
Creates a circular kernel with width
2*radius + 1. |
static javax.media.jai.KernelJAI |
createCircle(int radius,
KernelFactory.ValueType type,
float centreValue)
Deprecated.
Please use
createCircle(int, ValueType) instead and
set the centre element value on the returned kernel if that is
required. |
static javax.media.jai.KernelJAI |
createConstantAnnulus(int outerRadius,
int innerRadius,
float value)
Creates an annular kernel (a doughnut) where elements inside the annulus
have a constant value while those outside are set to 0.
|
static javax.media.jai.KernelJAI |
createConstantCircle(int radius,
float value)
Create a circular kernel where all elements within the circle
have a constant value while those outside have value 0.0.
|
static javax.media.jai.KernelJAI |
createConstantRectangle(int width,
int height,
float value)
Creates a rectangular kernel where all elements have the same value.
|
static javax.media.jai.KernelJAI |
createConstantRectangle(int width,
int height,
int keyX,
int keyY,
float value)
Creates a rectangular kernel where all elements have the same value.
|
static javax.media.jai.KernelJAI |
createFromShape(Shape shape,
AffineTransform transform,
KernelFactory.ValueType type,
int keyX,
int keyY,
float keyValue)
Create a kernel by rasterizing a shape.
|
static javax.media.jai.KernelJAI |
createRectangle(int width,
int height)
Creates a rectangular kernel where all elements have value 1.0.
|
static javax.media.jai.KernelJAI |
createRectangle(int width,
int height,
KernelFactory.ValueType type,
int keyX,
int keyY)
Creates a rectangular kernel.
|
static javax.media.jai.KernelJAI |
createRectangle(int width,
int height,
KernelFactory.ValueType type,
int keyX,
int keyY,
float keyValue)
Deprecated.
Please use
createRectangle(int, int, ValueType, int, int)
instead and set the centre element value on the returned kernel if that is
required. |
public static javax.media.jai.KernelJAI createCircle(int radius)
2*radius + 1.
The key element is at position x=radius, y=radius.
This is equivalent to:
createCircle(radius, Kernel.ValueType.BINARY, 1.0f)
radius - radius of the circleKernelJAI objectpublic static javax.media.jai.KernelJAI createConstantCircle(int radius,
float value)
2*radius + 1.
The key element is at position x=radius, y=radius.radius - radius of the circlevalue - constant valueKernelJAI objectpublic static javax.media.jai.KernelJAI createCircle(int radius,
KernelFactory.ValueType type,
float centreValue)
createCircle(int, ValueType) instead and
set the centre element value on the returned kernel if that is
required.2*radius + 1.
The key element is at position x=radius, y=radius.radius - the radius of the circle expressed in pixelstype - a KernelFactory.ValueType constantcentreValue - the value to assign to the kernel centre (key element)KernelJAI objectpublic static javax.media.jai.KernelJAI createCircle(int radius,
KernelFactory.ValueType type)
2*radius + 1.
The key element is at position x=radius, y=radius.
If type is KernelFactory.ValueType.INVERSE_DISTANCE the kernel's
key element will be set to 1.0f.
radius - the radius of the circle expressed in pixelstype - a KernelFactory.ValueType constantKernelJAI objectpublic static javax.media.jai.KernelJAI createAnnulus(int outerRadius,
int innerRadius,
KernelFactory.ValueType type,
float centreValue)
createAnnulus(int, int, ValueType) instead and
set the centre element value on the returned kernel if that is
required.2*outerRadius + 1.
The kernel's key element is at position x=outerRadius, y=outerRadius.
Calling this method with innerRadius == 0 is equivalent to
calling createCircle(int)
outerRadius - the radius of the annulusinnerRadius - the radius of the 'hole'type - a KernelFactory.ValueType constantcentreValue - the value to assign to the kernel centre (key element)KernelJAI objectIllegalArgumentException - if outerRadius <= 0 or
innerRadius >= outerRadiuspublic static javax.media.jai.KernelJAI createConstantAnnulus(int outerRadius,
int innerRadius,
float value)
The kernel width is 2*outerRadius + 1.
The kernel's key element is at position x=outerRadius, y=outerRadius.
outerRadius - the outer radius of the annulusinnerRadius - the radius of the 'hole'value - element valueKernelJAI objectIllegalArgumentException - if outerRadius <= 0 or
innerRadius >= outerRadiuspublic static javax.media.jai.KernelJAI createAnnulus(int outerRadius,
int innerRadius,
KernelFactory.ValueType type)
innerRadius is 0 the
returned kernel will be identical to that from createCircle(outerRadius, type).
The kernel width is 2*outerRadius + 1.
The kernel's key element is at position x=outerRadius, y=outerRadius.
outerRadius - the outer radius of the annulusinnerRadius - the radius of the 'hole'type - a KernelFactory.ValueType constantKernelJAI objectIllegalArgumentException - if outerRadius <= 0 or
innerRadius >= outerRadiuspublic static javax.media.jai.KernelJAI createRectangle(int width,
int height)
(width/2, height/2).width - rectangle widthheight - rectangle heightKernelJAI objectIllegalArgumentException - if either width or height
are less than 1public static javax.media.jai.KernelJAI createConstantRectangle(int width,
int height,
float value)
(width/2, height/2).width - rectangle widthheight - rectangle heightvalue - element valueKernelJAI objectIllegalArgumentException - if either width or height
are less than 1public static javax.media.jai.KernelJAI createConstantRectangle(int width,
int height,
int keyX,
int keyY,
float value)
width - rectangle widthheight - rectangle heightvalue - element valuekeyX - key element X ordinatekeyY - key element Y ordinateKernelJAI objectIllegalArgumentException - if either width or height
are less than 1 or if the key element location is outside the
rectanglepublic static javax.media.jai.KernelJAI createRectangle(int width,
int height,
KernelFactory.ValueType type,
int keyX,
int keyY,
float keyValue)
createRectangle(int, int, ValueType, int, int)
instead and set the centre element value on the returned kernel if that is
required.KernelFactory.ValueType.COSINE or
KernelFactory.ValueType.EPANECHNIKOV, this is calculated as the proportion of the
maximum distance from the key element to a kernel edge element.width - rectangle widthheight - rectangle heighttype - a KernelFactory.ValueType constantkeyX - X ordinate of the key elementkeyY - Y ordinate of the key element (0 is top)keyValue - value of the key elementKernelJAI objectIllegalArgumentException - if either width or height
are less than 1; or if keyX is not in the interval [0,width);
or if keyY is not in the interval [0,height);public static javax.media.jai.KernelJAI createRectangle(int width,
int height,
KernelFactory.ValueType type,
int keyX,
int keyY)
KernelFactory.ValueType.COSINE or
KernelFactory.ValueType.EPANECHNIKOV, this is calculated as the proportion of the
maximum distance from the key element to a kernel edge element.width - rectangle widthheight - rectangle heighttype - a KernelFactory.ValueType constantkeyX - X ordinate of the key elementkeyY - Y ordinate of the key element (0 is top)KernelJAI objectIllegalArgumentException - if either width or height
are less than 1; or if keyX is not in the interval [0,width);
or if keyY is not in the interval [0,height);public static javax.media.jai.KernelJAI createFromShape(Shape shape, AffineTransform transform, KernelFactory.ValueType type, int keyX, int keyY, float keyValue)
This method can cope with arbitrary shape bounds, ie. there is no need to set the bounding rectangle to have origin x=0, y=0. The values of keyX and keyY, which specify the position of the kernel's key element, must be within the bounds of the shape as passed to this method, but do not need to be inside the shape itself.
shape - an object representing a closed polygontransform - an optional AffineTransform to relate shape coordinates to
kernel element coordinates. May be null. This is useful to scale and/or rotate
the shape.type - a KernelFactory.ValueType constantkeyX - X ordinate of the key elementkeyY - Y ordinate of the key elementkeyValue - the value of the key elementCopyright © 2009–2020. All rights reserved.