Class SgmCostBase<T extends ImageBase<T>>

All Implemented Interfaces:
Direct Known Subclasses:
SgmCostAbsoluteDifference, SgmCostHamming, SgmMutualInformation_U8

public abstract class SgmCostBase<T extends ImageBase<T>> extends Object implements SgmDisparityCost<T>
Base class for computing SGM cost using single pixel error metrics. It handles iterating through all possible disparity values for all pixels in the image and any other book keeping. Only the score needs to be implemented.
  • Field Details

    • left

      protected T extends ImageBase<T> left
    • costXD

      protected GrayU16 costXD
    • disparityMin

      protected int disparityMin
    • disparityRange

      protected int disparityRange
  • Constructor Details

    • SgmCostBase

      public SgmCostBase()
  • Method Details

    • configure

      public void configure(int disparityMin, int disparityRange)
      Description copied from interface: SgmDisparityCost
      Configures the disparity search
      Specified by:
      configure in interface SgmDisparityCost<T extends ImageBase<T>>
      disparityMin - Minimum possible disparity, inclusive
      disparityRange - Number of possible disparity values estimated. The max possible disparity is min+range-1.
    • process

      public void process(T left, T right, Planar<GrayU16> costYXD)
      Description copied from interface: SgmDisparityCost
      Computes the score for all possible disparity values across all pixels. If a disparity value would go outside of the image then the cost is set to SgmDisparityCost.MAX_COST
      Specified by:
      process in interface SgmDisparityCost<T extends ImageBase<T>>
      left - left image
      right - right image
      costYXD - Cost of output scaled to have a range of 0 to SgmDisparityCost.MAX_COST, inclusive. Reshaped to match input and disparity range.
    • computeDisparityErrors

      protected abstract void computeDisparityErrors(int idxLeft, int idxRight, int idxOut, int localRange)