java.lang.Object
imagingbook.common.morphology.StructuringElements
This class defines static methods related to binary structuring elements (kernels).
-
Method Summary
Modifier and TypeMethodDescriptionstatic byte[][]makeBoxKernel(int radius) Creates and returns a square binary "box" kernel with the specified radius.static byte[][]Creates and returns a square binary structuring element (kernel) of size 3x3 (radius 1).static byte[][]makeDiskKernel(double radius) Creates and returns a square binary "disk" kernel with the specified radius.static byte[][]reflect(byte[][] H) Returns a copy of the specified structuring element that is mirrored along both axes.static byte[][]toByteArray(int[][] iA) Converts the specifiedint[][]to abyte[][], which is returned.
-
Method Details
-
makeBoxKernel3x3
Creates and returns a square binary structuring element (kernel) of size 3x3 (radius 1).- Returns:
- a 3x3 binary box kernel
-
makeBoxKernel
Creates and returns a square binary "box" kernel with the specified radius. The kernel size is (2 * radius + 1) x (2 * radius + 1). It is always odd.- Parameters:
radius- the kernel radius- Returns:
- a square binary box kernel
-
makeDiskKernel
Creates and returns a square binary "disk" kernel with the specified radius. The kernel size is (2 * radius + 1) x (2 * radius + 1). It is always odd.- Parameters:
radius- the kernel radius- Returns:
- a square binary disk kernel
-
toByteArray
Converts the specifiedint[][]to abyte[][], which is returned.- Parameters:
iA- theint[][]array to be converted- Returns:
- the resulting
byte[][]
-
reflect
Returns a copy of the specified structuring element that is mirrored along both axes. For example| A B | | C D |
converts to| D C | | B A |
- Parameters:
H- the original structuring element- Returns:
- the reflected structuring element
-