VisionWorks SGBM subpixel quadratic interpolation

I use the SGBM node in visionworks by following the tutorial at VisionWorks API > Samples and Demos > Demo Applications > Stereo Matching Demo App.

I note that the implementation is different to opencv SGBM implementation. There is no post-process in visionworks version, such as subpixel quadratic interpolation.

In opencv, it does subpixel quadratic interpolation to get preciser disparities. The code is below,

// do subpixel quadratic interpolation:
//   fit parabola into (x1=d-1, y1=Sp[d-1]), (x2=d, y2=Sp[d]), (x3=d+1, y3=Sp[d+1])
//   then find minimum of the parabola.
int denom2 = std::max(Sp[d-1] + Sp[d+1] - 2*Sp[d], 1);
d = d*DISP_SCALE + ((Sp[d-1] - Sp[d+1])*DISP_SCALE + denom2)/(denom2*2);

However, sgbm node in visionworks does not contain this operation.

  1. Are there any other API to do this interpolation for sgbm?
  2. If not, how can i add the interpolation into my visionworks code? I cannot do this operation after sgbm node, since i need to do this during the searching in block matching.

@AastaLLL

Hi,

In SGBM algorithm, there are two steps are related to this issue:

  1. Image is downscaled by factor 4 for performance
  2. Algorithm obtains a disparity image in fixed-point 16-bit values with a Q11.4 format.
    For display, the disparity map is converted from fixed-point representation to 8-bit values.

If you want a more delicate disparity resolution, try this:

  1. Apply SGBM without downscaling
  2. Don’t apply the representation conversion

More detail can be found in VisionWorks API > NVIDIA Extension API > Vision Primitives API > Semi-Global Matching.
Thanks.