Package org.eclipse.imagen.media.kernel
Class KernelUtil
Object
KernelUtil
Static utility methods for KernelImageN objects.
- Since:
- 1.0
- Author:
- Michael Bedward
-
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionstatic StringkernelToString(KernelImageN kernel, boolean multiLine) A utility function that returns a string representation of a KernelImageN object's data.static KernelImageNsetElement(KernelImageN kernel, int x, int y, float newValue) Creates a new kernel by copying the one provided and setting the element at(x, y)tovalue.static KernelImageNstandardize(KernelImageN kernel) Create a copy of the input kernel with element values standardized to sum to 1.0.
-
Constructor Details
-
KernelUtil
public KernelUtil()
-
-
Method Details
-
standardize
public static KernelImageN standardize(KernelImageN kernel) Create a copy of the input kernel with element values standardized to sum to 1.0. The input kernel's dimensions and location of the key element are retained by the new kernel.- Parameters:
kernel- the input kernel- Returns:
- a new KernelImageN object
-
setElement
public static KernelImageN setElement(KernelImageN kernel, int x, int y, float newValue) Creates a new kernel by copying the one provided and setting the element at(x, y)tovalue.- Parameters:
kernel- the existing kernelx- element X ordinatey- element Y ordinatenewValue- new element value- Returns:
- the new kernel
- Throws:
IllegalArgumentException- ifkernelisnullorxoryare out of bounds
-
kernelToString
A utility function that returns a string representation of a KernelImageN object's data.- Parameters:
kernel- the input kernelmultiLine- if true, each row of kernel data is followed by a newline; if false, the string contains no newlines- Returns:
- a String
-