Interface SgmDisparityCost<T extends ImageBase<T>>

All Known Implementing Classes:
SgmCostAbsoluteDifference, SgmCostAbsoluteDifference.U8, SgmCostBase, SgmCostFromBlocks, SgmCostHamming, SgmCostHamming.S32, SgmCostHamming.S64, SgmCostHamming.U8, SgmMutualInformation_U8

public interface SgmDisparityCost<T extends ImageBase<T>>

Computes a stack of matching costs for all pixels across all possible disparities for use with SgmCostAggregation. Pay close attention to the element ordering in the output. Ordering was selected to reduce CPU cache misses when aggregating the costs.

The output is really a 3D tensor, but to avoid creating another custom data type planar images are used. The other reason to use a planar image is that it was desirable to have multiple arrays define the tensor.

Format of costYXD. YXD indicates the ordering of values in the tensor. The outer most is T, which is the bands. X is the row in a planar image and D the columns. Thus, (y,x,d) = costYXD.getBand(y).get(d,x-disparityMin).

  • Field Summary

    Fields
    Modifier and Type
    Field
    Description
    static final int
    Maximum allowed cost fo a disparity 11-bits as suggested in the paper
  • Method Summary

    Modifier and Type
    Method
    Description
    void
    configure(int disparityMin, int disparityRange)
    Configures the disparity search
    void
    process(T left, T right, Planar<GrayU16> costYXD)
    Computes the score for all possible disparity values across all pixels.
  • Field Details

    • MAX_COST

      static final int MAX_COST
      Maximum allowed cost fo a disparity 11-bits as suggested in the paper
      See Also:
  • Method Details

    • configure

      void configure(int disparityMin, int disparityRange)
      Configures the disparity search
      Parameters:
      disparityMin - Minimum possible disparity, inclusive
      disparityRange - Number of possible disparity values estimated. The max possible disparity is min+range-1.
    • process

      void process(T left, T right, Planar<GrayU16> costYXD)
      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 MAX_COST
      Parameters:
      left - left image
      right - right image
      costYXD - Cost of output scaled to have a range of 0 to MAX_COST, inclusive. Reshaped to match input and disparity range.