- java.lang.Object
-
- java.awt.image.Kernel
-
- All Implemented Interfaces:
- Cloneable
public class Kernel extends Object implements Cloneable
TheKernel
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.- See Also:
ConvolveOp
-
-
Constructor Summary
Constructors Constructor and Description Kernel(int width, int height, float[] data)
Constructs aKernel
object from an array of floats.
-
Method Summary
Methods Modifier and Type Method and Description Object
clone()
Clones this object.int
getHeight()
Returns the height of thisKernel
.float[]
getKernelData(float[] data)
Returns the kernel data in row major order.int
getWidth()
Returns the width of thisKernel
.int
getXOrigin()
Returns the X origin of thisKernel
.int
getYOrigin()
Returns the Y origin of thisKernel
.
-
-
-
Constructor Detail
-
Kernel
public Kernel(int width, int height, float[] data)
Constructs aKernel
object from an array of floats. The firstwidth
*height
elements of thedata
array are copied. If the length of thedata
array is less than width*height, anIllegalArgumentException
is thrown. The X origin is (width-1)/2 and the Y origin is (height-1)/2.- Parameters:
width
- width of the kernelheight
- height of the kerneldata
- kernel data in row major order- Throws:
IllegalArgumentException
- if the length ofdata
is less than the product ofwidth
andheight
-
-
Method Detail
-
getXOrigin
public final int getXOrigin()
Returns the X origin of thisKernel
.- Returns:
- the X origin.
-
getYOrigin
public final int getYOrigin()
Returns the Y origin of thisKernel
.- Returns:
- the Y origin.
-
getWidth
public final int getWidth()
Returns the width of thisKernel
.- Returns:
- the width of this
Kernel
.
-
getHeight
public final int getHeight()
Returns the height of thisKernel
.- Returns:
- the height of this
Kernel
.
-
getKernelData
public final float[] getKernelData(float[] data)
Returns the kernel data in row major order. Thedata
array is returned. Ifdata
isnull
, a new array is allocated.- Parameters:
data
- if non-null, contains the returned kernel data- Returns:
- the
data
array containing the kernel data in row major order or, ifdata
isnull
, a newly allocated array containing the kernel data in row major order - Throws:
IllegalArgumentException
- ifdata
is less than the size of thisKernel
-
-
Document created the 11/06/2005, last modified the 04/03/2020
Source of the printed document:https://www.gaudry.be/en/java-api-rf-java/awt/image/kernel.html
The infobrol is a personal site whose content is my sole responsibility. The text is available under CreativeCommons license (BY-NC-SA). More info on the terms of use and the author.
References
These references and links indicate documents consulted during the writing of this page, or which may provide additional information, but the authors of these sources can not be held responsible for the content of this page.
The author This site is solely responsible for the way in which the various concepts, and the freedoms that are taken with the reference works, are presented here. Remember that you must cross multiple source information to reduce the risk of errors.