This allows to scale the matching cost function by a power of 2 or enable an experimental contrast invariant matching mode. Usually you will not need to scale the cost function, unless stereo pairs look very dissimilar, even in correctly associated areas. Then the clipping of large cost values might affect the matching result and downscaling the cost values might help to recover more complete depth information from the stereo pairs.

A special value of -8 is used to enable full contrast invariance. In this case the matching score function is reduced to binary brightness differences. This improves resistance to reflections and contrast variations of the pattern between left and right camera perspective. On the other hand there is less information available for subpixel interpolation and thus Z-accuracy is reduced.



An integer (zero or negative), specifying the number of low-order bits to discard from the matching cost function.


Setting CostScale to -2 will discard the lower two bits of the pixel association cost.