public class Kernel extends Object implements Serializable
Class that represents an one dimensional array of coefficients for a weighted filtering.
Functionality includes:
Constructor and Description |
---|
Kernel(double... values)
Creates a new kernel object with the specified values and an offset
being half the size of this kernel (rounded down).
|
Kernel(int offset,
double[] values)
Creates a new Kernel object with the specified offset and values.
|
Modifier and Type | Method and Description |
---|---|
Kernel |
add(double v)
Returns a new Kernel, where the specified value was added to each of
the items.
|
Kernel |
add(Kernel k)
Returns a new Kernel, where the specified kernel was added.
|
double |
get(int i)
Returns the value at the specified position of this kernel.
|
int |
getMaxIndex()
Returns the index of the "rightmost" value.
|
int |
getMinIndex()
Returns the index of the "leftmost" value.
|
int |
getOffset()
Returns the offset of this kernel.
|
Kernel |
mul(double v)
Returns a new Kernel, where the specified value was multiplied with
each of the items.
|
Kernel |
mul(Kernel k)
Returns a new Kernel, where the specified kernel was multiplied.
|
Kernel |
negate()
Returns a Kernel with all values being negated.
|
Kernel |
normalize()
Returns a normalized Kernel so that the sum of all values equals 1.
|
protected void |
set(int i,
double v)
Sets the specified index of this kernel to the specified value.
|
int |
size()
Returns the number of values in this kernel.
|
public Kernel(int offset, double[] values)
offset
- Offset to the first item in the kernel.values
- Array of values in the kernel.public Kernel(double... values)
values
- Data values for the kernel.public double get(int i)
i
- Index to be returned.protected void set(int i, double v)
i
- Index to be changed.v
- Value to be set.public int getOffset()
public int size()
public int getMinIndex()
public int getMaxIndex()
public Kernel add(double v)
v
- Value to be added.public Kernel add(Kernel k)
k
- Kernel to be added.public Kernel mul(double v)
v
- Value to be multiplied.public Kernel mul(Kernel k)
k
- Kernel to be multiplied.public Kernel normalize()
public Kernel negate()
Copyright © 2009-2013. All Rights Reserved.