java.lang.Object
imagingbook.common.filter.linear.Kernel1D
- Direct Known Subclasses:
GaussianKernel1D
This class represents a 1D filter kernel.
- Version:
- 2020/12/29
-
Constructor Summary
Constructors -
Method Summary
-
Constructor Details
-
Kernel1D
Constructor. The kernel's hot spot is at its center. The kernel is normalized.- Parameters:
h
- the 1D kernel array
-
Kernel1D
Constructor. The hot spot index must be specified. The kernel is optionally normalized.- Parameters:
h
- the 1D kernel arrayxc
- the x-coordinate of the kernel's hot spot, default is (width-1)/2normalize
- if true the kernel is normalized (to sum = 1)
-
-
Method Details
-
getH
Returns the kernel's 1D array.- Returns:
- the kernel's 1D array
-
getWidth
Returns the width (length) of this kernel.- Returns:
- the kernel's width
-
getXc
Returns the center coordinate of this kernel.- Returns:
- the kernel's center coordinate
-
normalize
Normalizes the specified array such that its sum becomes 1. Throws an exception if the array's sum is zero. The original array is not modified.- Parameters:
A
- a 1D array- Returns:
- the normalized array
- Throws:
ArithmeticException
- if array sums to zero
-