Class CensusTransform

java.lang.Object
boofcv.alg.transform.census.CensusTransform

public class CensusTransform extends Object

The Census Transform [1] computes a bit mask for each pixel in the image. If a neighboring pixel is greater than the center pixel in a region that bit is set to 1. A 3x3 region 9radius=1) is encoded in 8-bits and a 5x5 region (radius=2) in 24-bits. To compute the error between two pixels simply compute the hamming distance. The hamming distance for an input can be computed using DescriptorDistance.hamming().

DEVELOPMENT NOTE: See if this can be speed up by only comparing each pixel with another once. Code will be complex

[1] Zabih, Ramin, and John Woodfill. "Non-parametric local transforms for computing visual correspondence." European conference on computer vision. Springer, Berlin, Heidelberg, 1994.

  • Constructor Details

    • CensusTransform

      public CensusTransform()
  • Method Details

    • createBlockSamples

      public static DogArray<Point2D_I32> createBlockSamples(int radius)
    • createBlockSamples

      public static DogArray<Point2D_I32> createBlockSamples(int radiusX, int radiusY)
    • createCircleSamples

      public static DogArray<Point2D_I32> createCircleSamples()
    • dense3x3

      public static void dense3x3(GrayU8 input, GrayU8 output, @Nullable @Nullable ImageBorder_S32<GrayU8> border)
      Census transform for local 3x3 region around each pixel.
      Parameters:
      input - Input image
      output - Census transformed output image
      border - (Nullable) How the border is handled
    • dense3x3

      public static void dense3x3(GrayU16 input, GrayU8 output, @Nullable @Nullable ImageBorder_S32<GrayU16> border)
      Census transform for local 3x3 region around each pixel.
      Parameters:
      input - Input image
      output - Census transformed output image
      border - (Nullable) How the border is handled
    • dense3x3

      public static void dense3x3(GrayF32 input, GrayU8 output, @Nullable @Nullable ImageBorder_F32 border)
      Census transform for local 3x3 region around each pixel.
      Parameters:
      input - Input image
      output - Census transformed output image
      border - (Nullable) How the border is handled
    • dense5x5

      public static void dense5x5(GrayU8 input, GrayS32 output, @Nullable @Nullable ImageBorder_S32<GrayU8> border)
      Census transform for local 5x5 region around each pixel.
      Parameters:
      input - Input image
      output - Census transformed output image
      border - (Nullable) How the border is handled
    • dense5x5

      public static void dense5x5(GrayU16 input, GrayS32 output, @Nullable @Nullable ImageBorder_S32<GrayU16> border)
      Census transform for local 5x5 region around each pixel.
      Parameters:
      input - Input image
      output - Census transformed output image
      border - (Nullable) How the border is handled
    • dense5x5

      public static void dense5x5(GrayF32 input, GrayS32 output, @Nullable @Nullable ImageBorder_F32 border)
      Census transform for local 5x5 region around each pixel.
      Parameters:
      input - Input image
      output - Census transformed output image
      border - (Nullable) How the border is handled
    • sample_S64

      public static void sample_S64(GrayU8 input, FastAccess<Point2D_I32> sample, GrayS64 output, @Nullable @Nullable ImageBorder_S32<GrayU8> border, @Nullable @Nullable DogArray_I32 workSpace)
      Census transform for an arbitrary region specified by the provided sample points
      Parameters:
      input - Input image
      sample - Relative coordinates that are sampled when computing the
      output - Census transformed output image
      border - (Nullable) How the border is handled
    • sample_S64

      public static void sample_S64(GrayU16 input, FastAccess<Point2D_I32> sample, GrayS64 output, @Nullable @Nullable ImageBorder_S32<GrayU16> border, @Nullable @Nullable DogArray_I32 workSpace)
      Census transform for an arbitrary region specified by the provided sample points
      Parameters:
      input - Input image
      sample - Relative coordinates that are sampled when computing the
      output - Census transformed output image
      border - (Nullable) How the border is handled
    • sample_S64

      public static void sample_S64(GrayF32 input, FastAccess<Point2D_I32> sample, GrayS64 output, @Nullable @Nullable ImageBorder_F32 border, @Nullable @Nullable DogArray_I32 workSpace)
      Census transform for an arbitrary region specified by the provided sample points
      Parameters:
      input - Input image
      sample - Relative coordinates that are sampled when computing the
      output - Census transformed output image
      border - (Nullable) How the border is handled
    • sample_IU16

      public static void sample_IU16(GrayU8 input, FastAccess<Point2D_I32> sample, InterleavedU16 output, @Nullable @Nullable ImageBorder_S32<GrayU8> border, @Nullable @Nullable DogArray_I32 workSpace)
      Census transform for an arbitrary region specified by the provided sample points
      Parameters:
      input - Input image
      sample - Relative coordinates that are sampled when computing the
      output - Census transformed output image
      border - (Nullable) How the border is handled
    • sample_IU16

      public static void sample_IU16(GrayU16 input, FastAccess<Point2D_I32> sample, InterleavedU16 output, @Nullable @Nullable ImageBorder_S32<GrayU16> border, @Nullable @Nullable DogArray_I32 workSpace)
      Census transform for an arbitrary region specified by the provided sample points
      Parameters:
      input - Input image
      sample - Relative coordinates that are sampled when computing the
      output - Census transformed output image
      border - (Nullable) How the border is handled
    • sample_IU16

      public static void sample_IU16(GrayF32 input, FastAccess<Point2D_I32> sample, InterleavedU16 output, @Nullable @Nullable ImageBorder_F32 border, @Nullable @Nullable DogArray_I32 workSpace)
      Census transform for an arbitrary region specified by the provided sample points
      Parameters:
      input - Input image
      sample - Relative coordinates that are sampled when computing the
      output - Census transformed output image
      border - (Nullable) How the border is handled