Class SgmStereoDisparityHmi
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.
-
Field Summary
Modifier and TypeFieldDescriptionprotected int
protected PyramidDiscreteNN2<GrayU8>
protected PyramidDiscreteNN2<GrayU8>
protected Random
protected StereoMutualInformation
Fields inherited from class boofcv.alg.disparity.sgm.SgmStereoDisparity
aggregation, costYXD, disparity, disparityMin, disparityRange, helper, score, selector, sgmCost
-
Constructor Summary
ConstructorDescriptionSgmStereoDisparityHmi
(ConfigDiscreteLevels configPyr, StereoMutualInformation stereoMI, SgmDisparitySelector selector) Provides configurations and internal implementations of different componentsSgmStereoDisparityHmi
(ConfigDiscreteLevels configPyr, StereoMutualInformation stereoMI, SgmDisparitySelector selector, SgmCostFromBlocks<GrayU8> blockScore) -
Method Summary
Modifier and TypeMethodDescriptionint
void
Computes disparity using pyramidal mutual information.void
Computes disparity from an initial disparity estimate.void
setExtraIterations
(int extraIterations) Methods inherited from class boofcv.alg.disparity.sgm.SgmStereoDisparity
getInvalidDisparity, saveScore, subpixel
-
Field Details
-
rand
-
stereoMI
-
extraIterations
protected int extraIterations -
pyrLeft
-
pyrRight
-
-
Constructor Details
-
SgmStereoDisparityHmi
public SgmStereoDisparityHmi(ConfigDiscreteLevels configPyr, StereoMutualInformation stereoMI, SgmDisparitySelector selector) Provides configurations and internal implementations of different components- Parameters:
configPyr
- Specifies number of layers in the pyramidstereoMI
- Computes mutual information from a stereo pair with known disparityselector
- Selects the best disparity given the cost
-
SgmStereoDisparityHmi
public SgmStereoDisparityHmi(ConfigDiscreteLevels configPyr, StereoMutualInformation stereoMI, SgmDisparitySelector selector, SgmCostFromBlocks<GrayU8> blockScore)
-
-
Method Details
-
process
Computes disparity using pyramidal mutual information.- Overrides:
process
in classSgmStereoDisparityError<GrayU8>
- Parameters:
left
- (Input) left rectified stereo imageright
- (Input) right rectified stereo image
-
process
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 imageright
- (Input) right rectified stereo imagedisparityEst
- (Input) Initial disparity estimate used to compute MI
-
getStereoMI
-
getPyrLeft
-
getPyrRight
-
getExtraIterations
public int getExtraIterations() -
setExtraIterations
public void setExtraIterations(int extraIterations)
-