public class Kernel
extends java.lang.Object
| Modifier and Type | Field and Description |
|---|---|
int |
cols |
static float[] |
EDGE_LAPLACE1 |
static float[] |
EDGE_LAPLACE2 |
static float[] |
FREI_CHEN_H |
static float[] |
FREI_CHEN_V |
float[] |
matrix |
static float[] |
PREWITT_H |
static float[] |
PREWITT_V |
static float |
R2 |
static float[] |
ROBERTS_H |
static float[] |
ROBERTS_V |
int |
rows |
static float[] |
SOBEL_H |
static float[] |
SOBEL_V |
int |
xCentre |
int |
yCentre |
| Constructor and Description |
|---|
Kernel()
Construct a null kernel.
|
Kernel(float[] matrix)
Construct a kernel with the given 3x3 matrix.
|
Kernel(int rows,
int cols,
float[] matrix)
Construct a kernel with the given matrix.
|
Kernel(int rows,
int cols,
int xCentre,
int yCentre,
float[] matrix)
Construct a kernel with the given matrix.
|
| Modifier and Type | Method and Description |
|---|---|
float[] |
getMatrix() |
void |
normalize()
Normalize a convolution kernel.
|
void |
setMatrix(float[] matrix)
Set the (3x3) convolution kernel.
|
void |
setMatrix(int rows,
int cols,
float[] matrix)
Set the convolution kernel.
|
void |
setMatrix(int rows,
int cols,
int xCentre,
int yCentre,
float[] matrix)
Set the convolution kernel.
|
public static final float R2
public static final float[] ROBERTS_V
public static final float[] ROBERTS_H
public static final float[] PREWITT_V
public static final float[] PREWITT_H
public static final float[] SOBEL_V
public static float[] SOBEL_H
public static final float[] FREI_CHEN_V
public static float[] FREI_CHEN_H
public static float[] EDGE_LAPLACE1
public static float[] EDGE_LAPLACE2
public float[] matrix
public int rows
public int cols
public int xCentre
public int yCentre
public Kernel()
public Kernel(float[] matrix)
matrix - an array of 9 floats containing the kernelpublic Kernel(int rows,
int cols,
float[] matrix)
rows - the number of rows in the kernelcols - the number of columns in the kernelmatrix - an array of rows*cols floats containing the kernelpublic Kernel(int rows,
int cols,
int xCentre,
int yCentre,
float[] matrix)
rows - the number of rows in the kernelcols - the number of columns in the kernelxCentre - the centre of the kernel in the x directionyCentre - the centre of the kernel in the y directionmatrix - an array of rows*cols floats containing the kernelpublic float[] getMatrix()
public void normalize()
public void setMatrix(float[] matrix)
matrix - an array of 9 floats containing the kernelpublic void setMatrix(int rows,
int cols,
float[] matrix)
rows - the number of rows in the kernelcols - the number of columns in the kernelmatrix - an array of rows*cols floats containing the kernelpublic void setMatrix(int rows,
int cols,
int xCentre,
int yCentre,
float[] matrix)
rows - the number of rows in the kernelcols - the number of columns in the kernelxCentre - the centre of the kernel in the x directionyCentre - the centre of the kernel in the y directionmatrix - an array of rows*cols floats containing the kernel