Skip to content
Snippets Groups Projects
Commit d1f856ff authored by Sebastian Hahta's avatar Sebastian Hahta
Browse files

Use meters instead of millimeters in disparity to depth conversions

parent 09477c79
No related branches found
No related tags found
No related merge requests found
......@@ -178,7 +178,7 @@ CalibrationChessboard::CalibrationChessboard(const map<string, string> &opt) {
getOptionInt(opt, "rows", 6));
image_size_ = Size( getOptionInt(opt, "width", 1280),
getOptionInt(opt, "height", 720));
pattern_square_size_ = getOptionDouble(opt, "square_size", 36.0);
pattern_square_size_ = getOptionDouble(opt, "square_size", 0.036);
LOG(INFO) << "Chessboard calibration parameters";
LOG(INFO) << " rows: " << pattern_size_.height;
......
......@@ -64,7 +64,7 @@ void disparityToDepth(const cv::Mat &disparity, cv::Mat &depth, const cv::Mat &q
cv::Vec4d homg_pt = _Q*cv::Vec4d(x, y, d, 1.0);
//dptr[x] = Vec3d(homg_pt.val);
//dptr[x] /= homg_pt[3];
dptr[x] = (homg_pt[2] / homg_pt[3]) / 1000.0f; // Depth in meters
dptr[x] = (homg_pt[2] / homg_pt[3]); // Depth in meters
if( fabs(d) <= FLT_EPSILON )
dptr[x] = 1000.0f;
......
......@@ -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)) / 1000.0f;
depth(v,u) = (d == 0) ? 50.0f : ((cam.baseline*cam.fx) / (d + cam.doffs));
}
}
}
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment