Class StructuringElements

java.lang.Object
imagingbook.common.morphology.StructuringElements

public abstract class StructuringElements extends Object
This class defines static methods related to binary structuring elements (kernels).
  • Method Summary

    Modifier and Type
    Method
    Description
    static 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 specified int[][] to a byte[][], which is returned.

    Methods inherited from class java.lang.Object

    clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
  • Method Details

    • makeBoxKernel3x3

      public static byte[][] makeBoxKernel3x3()
      Creates and returns a square binary structuring element (kernel) of size 3x3 (radius 1).
      Returns:
      a 3x3 binary box kernel
    • makeBoxKernel

      public static byte[][] makeBoxKernel(int radius)
      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

      public static byte[][] makeDiskKernel(double radius)
      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

      public static byte[][] toByteArray(int[][] iA)
      Converts the specified int[][] to a byte[][], which is returned.
      Parameters:
      iA - the int[][] array to be converted
      Returns:
      the resulting byte[][]
    • reflect

      public static byte[][] reflect(byte[][] H)
      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