Kernelpublic class Kernel extends Object implements CloneableThe Kernel class defines a matrix that describes how a
specified pixel and its surrounding pixels affect the value
computed for the pixel's position in the output image of a filtering
operation. The X origin and Y origin indicate the kernel matrix element
that corresponds to the pixel position for which an output value is
being computed. |
Fields Summary |
---|
private int | width | private int | height | private int | xOrigin | private int | yOrigin | private float[] | data |
Constructors Summary |
---|
public Kernel(int width, int height, float[] data)Constructs a Kernel object from an array of floats.
The first width *height elements of
the data array are copied.
If the length of the data array is less
than width*height, an IllegalArgumentException is thrown.
The X origin is (width-1)/2 and the Y origin is (height-1)/2.
ColorModel.loadLibraries();
initIDs();
this.width = width;
this.height = height;
this.xOrigin = (width-1)>>1;
this.yOrigin = (height-1)>>1;
int len = width*height;
if (data.length < len) {
throw new IllegalArgumentException("Data array too small "+
"(is "+data.length+
" and should be "+len);
}
this.data = new float[len];
System.arraycopy(data, 0, this.data, 0, len);
|
Methods Summary |
---|
public java.lang.Object | clone()Clones this object.
try {
return super.clone();
} catch (CloneNotSupportedException e) {
// this shouldn't happen, since we are Cloneable
throw new InternalError();
}
| public final int | getHeight()Returns the height of this Kernel .
return height;
| public final float[] | getKernelData(float[] data)Returns the kernel data in row major order.
The data array is returned. If data
is null , a new array is allocated.
if (data == null) {
data = new float[this.data.length];
}
else if (data.length < this.data.length) {
throw new IllegalArgumentException("Data array too small "+
"(should be "+this.data.length+
" but is "+
data.length+" )");
}
System.arraycopy(this.data, 0, data, 0, this.data.length);
return data;
| public final int | getWidth()Returns the width of this Kernel .
return width;
| public final int | getXOrigin()Returns the X origin of this Kernel .
return xOrigin;
| public final int | getYOrigin()Returns the Y origin of this Kernel .
return yOrigin;
| private static native void | initIDs()
|
|