public class Kernel extends Object implements Cloneable
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 filter matrix element
that corresponds to the pixel position for which an output value is
being computed.Constructor and Description |
---|
Kernel(int width,
int height,
double[] data)
Constructs a
Kernel object from an array of floats. |
Kernel(int width,
int height,
double factor,
double[] data)
Constructs a
Kernel object from an array of floats. |
Kernel(int width,
int height,
int xOrigin,
int yOrigin,
double factor,
double[] data)
Constructs a
Kernel object from an array of floats. |
Modifier and Type | Method and Description |
---|---|
Object |
clone()
Clones this object.
|
double |
getFactor()
Returns the factor of this
Kernel . |
int |
getHeight()
Returns the height of this
Kernel . |
double[] |
getKernelData(double[] data)
Returns the filter data in row major order.
|
int |
getWidth()
Returns the width of this
Kernel . |
int |
getXOrigin()
Returns the X origin of this
Kernel . |
int |
getYOrigin()
Returns the Y origin of this
Kernel . |
public Kernel(int width, int height, double[] data)
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.width
- width of the filterheight
- height of the filterdata
- filter data in row major orderIllegalArgumentException
- if the length of data
is less than the product of width
and
height
public Kernel(int width, int height, double factor, double[] data)
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.width
- width of the filterheight
- height of the filterfactor
- factor to be applied to each element of data
data
- filter data in row major orderIllegalArgumentException
- if the length of data
is less than the product of width
and
height
public Kernel(int width, int height, int xOrigin, int yOrigin, double factor, double[] data)
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.width
- width of the filterheight
- height of the filterxOrigin
- X origin of the filteryOrigin
- Y origin of the filterfactor
- factor to be applied to each element of data
data
- filter data in row major orderIllegalArgumentException
- if the length of data
is less than the product of width
and
height
public final int getXOrigin()
Kernel
.public final int getYOrigin()
Kernel
.public final int getWidth()
Kernel
.Kernel
.public final int getHeight()
Kernel
.Kernel
.public final double getFactor()
Kernel
.Kernel
.public final double[] getKernelData(double[] data)
data
array is returned. If data
is null
, a new array is allocated.data
- if non-null, contains the returned filter datadata
array containing the filter data
in row major order or, if data
is
null
, a newly allocated array containing
the filter data in row major orderIllegalArgumentException
- if data
is less
than the size of this Kernel
Copyright © 2014–2017 European Space Agency (ESA). All rights reserved.