Class SgmStereoDisparityHmi


public class SgmStereoDisparityHmi extends SgmStereoDisparityError<GrayU8>

Estimates stereo disparity using Semi Global Matching and Hierarchical Mutual Information Cost. This is intended to be a faithful reproduction of the algorithm described in [1] with no significant deviations.

SGM works by computing the path cost along (2,4,8, or 16) directions for each pixel. These costs are summed up and the path which minimizes the total cost is selected. By considering multiple paths along different directions it avoids the pitfalls of earlier approaches, such as dynamic programming along the x-axis only. It is also by far faster than globally optimal approaches but slower then approaches such as block matching

MI cost requires prior information to compute. If the disparity is known then MI can be found. However, we want to find the disparity using MI. To get around this problem a pyramidal approach is used to estimate MI. The MI cost is initially assigned random values. This is then used to estimate the disparity at the lowest resolution image in the pyramid. The found disparity is used to update the MI estimate. This process is repeated until it reaches the highest resolution layer. By this point it should have a good model for MI.

See Also:
  • Field Details

  • Constructor Details

  • Method Details

    • process

      public void process(GrayU8 left, GrayU8 right)
      Computes disparity using pyramidal mutual information.
      Overrides:
      process in class SgmStereoDisparityError<GrayU8>
      Parameters:
      left - (Input) left rectified stereo image
      right - (Input) right rectified stereo image
    • process

      public void process(GrayU8 left, GrayU8 right, GrayU8 disparityEst, int invalid)
      Computes disparity from an initial disparity estimate. A pyramid is not required because of the initial disparity estimate. This function can be called iteratively to improve the estimate.
      Parameters:
      left - (Input) left rectified stereo image
      right - (Input) right rectified stereo image
      disparityEst - (Input) Initial disparity estimate used to compute MI
    • getStereoMI

      public StereoMutualInformation getStereoMI()
    • getPyrLeft

      public PyramidDiscreteNN2<GrayU8> getPyrLeft()
    • getPyrRight

      public PyramidDiscreteNN2<GrayU8> getPyrRight()
    • getExtraIterations

      public int getExtraIterations()
    • setExtraIterations

      public void setExtraIterations(int extraIterations)