|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: INNER | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Object | +--javax.media.jai.KernelJAI
A kernel representing a matrix with a key position,
used by operators such as Convolve
.
A KernelJAI
is characterized by its width, height, and
origin, or key element. The key element is the element which is placed
over the current source pixel to perform convolution or error diffusion.
A kernel K is separable it the outer product of two one-dimensional vectors. It can speed up computation. One can construct a kernel from two one-dimensional vectors. <>The symmetry can be useful (such as computation speedup). Currently the protected instance variables isHorizonallySymmetric and isVerticallySymmetric are set to false.
ConvolveDescriptor
,
OrderedDitherDescriptor
,
ErrorDiffusionDescriptor
, Serialized FormField Summary | |
protected float[] |
data
The kernel data in row-major format. |
protected float[] |
dataH
The horizontal data for a separable kernel |
protected float[] |
dataV
The vertical data for a separable kernel |
static KernelJAI[] |
DITHER_MASK_441
4x4x1 mask useful for dithering 8-bit grayscale images to 1-bit images. |
static KernelJAI[] |
DITHER_MASK_443
4x4x3 mask useful for dithering 24-bit color images to 8-bit pseudocolor images. |
static KernelJAI |
ERROR_FILTER_FLOYD_STEINBERG
Floyd and Steinberg error filter (1975). |
static KernelJAI |
ERROR_FILTER_JARVIS
Jarvis, Judice, and Ninke error filter (1976). |
static KernelJAI |
ERROR_FILTER_STUCKI
Stucki error filter (1981). |
static KernelJAI |
GRADIENT_MASK_SOBEL_HORIZONTAL
Gradient Mask for SOBEL_HORIZONTAL |
static KernelJAI |
GRADIENT_MASK_SOBEL_VERTICAL
Gradient Mask for SOBEL_VERTICAL |
protected int |
height
The height of the kernel. |
protected boolean |
isHorizontallySymmetric
True if the kernel has horizontal (Y axis) symmetry. |
protected boolean |
isSeparable
True if the kernel is separable. |
protected boolean |
isVerticallySymmetric
True if the kernel has vertical (X axis) symmetry. |
protected KernelJAI |
rotatedKernel
Variable to cache a copy of the rotated kernel |
protected int |
width
The width of the kernel. |
protected int |
xOrigin
The X coordinate of the key element. |
protected int |
yOrigin
The Y coordinate of the key element. |
Constructor Summary | |
KernelJAI(int width,
int height,
float[] data)
Constructs a kernel with the given parameters. |
|
KernelJAI(int width,
int height,
int xOrigin,
int yOrigin,
float[] data)
Constructs a KernelJAI with the given parameters. |
|
KernelJAI(int width,
int height,
int xOrigin,
int yOrigin,
float[] dataH,
float[] dataV)
Constructs a separable KernelJAI from two float arrays. |
|
KernelJAI(Kernel k)
Constructs a KernelJAI from a java.awt.image.Kernel object. |
Method Summary | |
int |
getBottomPadding()
Returns the number of pixels required below the key element. |
float |
getElement(int xIndex,
int yIndex)
Returns a given element of the kernel. |
int |
getHeight()
Returns the height of the kernel. |
float[] |
getHorizontalKernelData()
Returns the horizontal portion of the kernel if the kernel is separable, or null otherwise. |
float[] |
getKernelData()
Returns a copy of the kernel data in row-major format. |
int |
getLeftPadding()
Returns the number of pixels required to the left of the key element. |
int |
getRightPadding()
Returns the number of pixels required to the right of the key element. |
KernelJAI |
getRotatedKernel()
Returns a 180 degree rotated version of the kernel. |
int |
getTopPadding()
Returns the number of pixels required above the key element. |
float[] |
getVerticalKernelData()
Returns the vertical portion of the kernel if the kernel is separable, or null otherwise. |
int |
getWidth()
Returns the width of the kernel. |
int |
getXOrigin()
Returns the X coordinate of the key kernel element. |
int |
getYOrigin()
Returns the Y coordinate of the key kernel element. |
boolean |
isHorizontallySymmetric()
Returns true if the kernel has horizontal (Y axis) symmetry. |
boolean |
isSeparable()
Returns true if the kernel is separable. |
boolean |
isVerticallySymmetric()
Returns true if the kernel has vertical (X axis) symmetry. |
Methods inherited from class java.lang.Object |
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Field Detail |
public static final KernelJAI ERROR_FILTER_FLOYD_STEINBERG
(1/16 x) [ * 7 ] [ 3 5 1 ]
public static final KernelJAI ERROR_FILTER_JARVIS
[ * 7 5 ] (1/48 x) [ 3 5 7 5 3 ] [ 1 3 5 3 1 ]
public static final KernelJAI ERROR_FILTER_STUCKI
[ * 7 5 ] (1/42 x) [ 2 4 8 4 2 ] [ 1 2 4 2 1 ]
public static final KernelJAI[] DITHER_MASK_441
public static final KernelJAI[] DITHER_MASK_443
public static final KernelJAI GRADIENT_MASK_SOBEL_HORIZONTAL
public static final KernelJAI GRADIENT_MASK_SOBEL_VERTICAL
protected int width
protected int height
protected int xOrigin
protected int yOrigin
protected float[] data
protected float[] dataH
protected float[] dataV
protected boolean isSeparable
protected boolean isHorizontallySymmetric
protected boolean isVerticallySymmetric
protected KernelJAI rotatedKernel
Constructor Detail |
public KernelJAI(int width, int height, int xOrigin, int yOrigin, float[] data)
width
- the width of the kernel.height
- the height of the kernel.xOrigin
- the X coordinate of the key kernel element.yOrigin
- the Y coordinate of the key kernel element.data
- the float data in row-major format.IllegalArgumentException
- if data is null.IllegalArgumentException
- if width is not a positive number.IllegalArgumentException
- if height is not a positive number.IllegalArgumentException
- if kernel data array does not have
width * height number of elements.public KernelJAI(int width, int height, int xOrigin, int yOrigin, float[] dataH, float[] dataV)
width
- the width of the kernel.height
- the height of the kernel.xOrigin
- the X coordinate of the key kernel element.yOrigin
- the Y coordinate of the key kernel element.dataH
- the float data for the horizontal direction.dataV
- the float data for the vertical direction.IllegalArgumentException
- if dataH is null.IllegalArgumentException
- if dataV is null.IllegalArgumentException
- if width is not a positive number.IllegalArgumentException
- if height is not a positive number.IllegalArgumentException
- if dataH does not have width elements.IllegalArgumentException
- if dataV does not have height elements.public KernelJAI(int width, int height, float[] data)
width
- the width of the kernel.height
- the height of the kernel.data
- the float data in row-major format.IllegalArgumentException
- if data is null.IllegalArgumentException
- if width is not a positive number.IllegalArgumentException
- if height is not a positive number.IllegalArgumentException
- if data does not have
width * height number of elements.public KernelJAI(Kernel k)
NullPointerException
- if k is null.Method Detail |
public int getWidth()
public int getHeight()
public int getXOrigin()
public int getYOrigin()
public float[] getKernelData()
public float[] getHorizontalKernelData()
null
otherwise. The kernel may
be tested for separability by calling isSeparable()
.public float[] getVerticalKernelData()
null
otherwise. The kernel may
be tested for separability by calling isSeparable()
.public float getElement(int xIndex, int yIndex)
ArrayIndexOutOfBoundsException
- if either xIndex or yIndex is
an invalid index.public boolean isSeparable()
public boolean isHorizontallySymmetric()
public boolean isVerticallySymmetric()
public int getLeftPadding()
public int getRightPadding()
public int getTopPadding()
public int getBottomPadding()
public KernelJAI getRotatedKernel()
|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: INNER | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |