Kernelpublic class Kernel extends Object implements CloneableThe Kernel class provides a matrix. This matrix is stored as a float array
which describes how a specified pixel affects the value calculated for the
pixel's position in the output image of a filtering operation. The X, Y
origins indicate the kernel matrix element which corresponds to the pixel
position for which an output value is being calculated. |
Fields Summary |
---|
private final int | xOriginThe x origin. | private final int | yOriginThe y origin. | private int | widthThe width. | private int | heightThe height. | float[] | dataThe data. |
Constructors Summary |
---|
public Kernel(int width, int height, float[] data)Instantiates a new Kernel with the specified float array. The
width*height elements of the data array are copied.
int dataLength = width * height;
if (data.length < dataLength) {
// awt.22B=Length of data should not be less than width*height
throw new IllegalArgumentException(Messages.getString("awt.22B")); //$NON-NLS-1$
}
this.width = width;
this.height = height;
this.data = new float[dataLength];
System.arraycopy(data, 0, this.data, 0, dataLength);
xOrigin = (width - 1) / 2;
yOrigin = (height - 1) / 2;
|
Methods Summary |
---|
public java.lang.Object | clone()Returns a copy of this Kernel object.
return new Kernel(width, height, data);
| public final int | getHeight()Gets the height of this Kernel.
return height;
| public final float[] | getKernelData(float[] data)Gets the float data array of this Kernel.
if (data == null) {
data = new float[this.data.length];
}
System.arraycopy(this.data, 0, data, 0, this.data.length);
return data;
| public final int | getWidth()Gets the width of this Kernel.
return width;
| public final int | getXOrigin()Gets the X origin of this Kernel.
return xOrigin;
| public final int | getYOrigin()Gets the Y origin of this Kernel.
return yOrigin;
|
|