Depth Image Conversions

Hello,

I’m comparing the Block Matching to the Semi-Global Block Matching algorithms in VisionWorks. I understand that the output of SGBM (nvxSemiGlobalMatchingNode) is a Q11.4 formatted S16, whereas the output of BM (nvxStereoBlockMatchingNode) is a U8. Two questions:

  1. What is the best way to convert that U8 to an S16, in Q11.4 format? I tried vxConvertDepthNode(), but it only does a bit shift…I think it also needs a scaling factor, no?

  2. Do you happen to know if the Q11.4 signed format of SGBM output is the same as the OpenCV StereoSGBM class function (specifically computeDisparitySGBM())? I think it is, but just want to check.

Hi,

You can find the more information of Q11.4 format here:
https://en.wikipedia.org/wiki/Q_(number_format)
[i]----------------------------------------------------
To convert a number from floating point to Qm.n format:

1. Multiply the floating point number by 2n
2. Round to the nearest integer

----------------------------------------------------[/i]

vxConvertDepthNode converts disparity from fixed point into gray scale.
Please check our document for the conversion rules:
[i]>> VisionWorks API

Khronos OpenVX 1.1 API
OpenVX API Modules
Vision Functions
Convert Bit Depth
vxConvertDepthNode[/i]

For question2, sorry that we are not familiar with the output format of OpenCV SGBM.
It’s recommended to check the output format in detail.
Suppose different implementation may have different disparity representation.

Thanks.