From 1051eebfc8092b9a363be4b7a65a58f40909506d Mon Sep 17 00:00:00 2001
From: Sebastian Hahta <joseha@utu.fi>
Date: Thu, 25 Jul 2019 11:11:12 +0300
Subject: [PATCH] disparity offset sign in disp to depth

To match OpenCV's convention
---
 components/rgbd-sources/src/algorithms/disp2depth.cu | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/components/rgbd-sources/src/algorithms/disp2depth.cu b/components/rgbd-sources/src/algorithms/disp2depth.cu
index 48e695d97..4b707c479 100644
--- a/components/rgbd-sources/src/algorithms/disp2depth.cu
+++ b/components/rgbd-sources/src/algorithms/disp2depth.cu
@@ -8,7 +8,7 @@ __global__ void d2d_kernel(cv::cuda::PtrStepSz<float> disp, cv::cuda::PtrStepSz<
 	for (STRIDE_Y(v,disp.rows)) {
 	for (STRIDE_X(u,disp.cols)) {
 		float d = disp(v,u);
-		depth(v,u) = (d == 0) ? 50.0f : ((cam.baseline*cam.fx) / (d + cam.doffs));
+		depth(v,u) = (d == 0) ? 50.0f : ((cam.baseline*cam.fx) / (d - cam.doffs));
 	}
 	}
 }
-- 
GitLab