- Notifications
You must be signed in to change notification settings - Fork5.9k
New odometry Pipeline#3055
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to ourterms of service andprivacy statement. We’ll occasionally send you account related emails.
Already on GitHub?Sign in to your account
Uh oh!
There was an error while loading.Please reload this page.
Changes fromall commits
10d102055a0efc249520c24d8a3cf4cf6157ab93aefac9a9aee8298503908267f118cb38ba6033c513e49aed206f7fc819d6380c6c01e6fc1301517dc6487d667f76eFile filter
Filter by extension
Conversations
Uh oh!
There was an error while loading.Please reload this page.
Jump to
Uh oh!
There was an error while loading.Please reload this page.
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -155,12 +155,13 @@ class ColoredKinFuImpl : public ColoredKinFu | ||
| private: | ||
| Params params; | ||
| Odometry icp; | ||
| cv::Ptr<Volume> volume; | ||
| int frameCounter; | ||
| Matx44f pose; | ||
| OdometryFrame renderFrame; | ||
| OdometryFrame prevFrame; | ||
| }; | ||
| @@ -172,13 +173,13 @@ ColoredKinFuImpl<MatType>::ColoredKinFuImpl(const Params &_params) : | ||
| params.tsdf_trunc_dist, params.tsdf_max_weight, params.truncateThreshold, | ||
| params.volumeDims[0], params.volumeDims[1], params.volumeDims[2]); | ||
| OdometrySettings ods; | ||
Contributor There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others.Learn more. What about other settings passed in MemberAuthor There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others.Learn more. yes | ||
| ods.setCameraMatrix(Mat(params.intr)); | ||
| ods.setMaxRotation(30.f); | ||
| ods.setMaxTranslation(params.voxelSize * (float)params.volumeDims[0] * 0.5f); | ||
| ods.setIterCounts(params.icpIterations); | ||
| icp = Odometry(OdometryType::DEPTH, ods, OdometryAlgoType::FAST); | ||
| reset(); | ||
| } | ||
| @@ -272,29 +273,32 @@ bool ColoredKinFuImpl<MatType>::updateT(const MatType& _depth, const MatType& _r | ||
| else | ||
| rgb = _rgb; | ||
| OdometryFrame newFrame = icp.createOdometryFrame(); | ||
| newFrame.setImage(rgb); | ||
| newFrame.setDepth(depth); | ||
| if(frameCounter == 0) | ||
| { | ||
| icp.prepareFrame(newFrame); | ||
| // use depth instead of distance | ||
| volume->integrate(depth, rgb, params.depthFactor, pose, params.intr, params.rgb_intr); | ||
| // TODO: try to move setPyramidLevel from kinfu to volume | ||
| newFrame.setPyramidLevel(params.icpIterations.size(), OdometryFramePyramidType::PYR_IMAGE); | ||
Contributor There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others.Learn more. I guess | ||
| newFrame.setPyramidAt(rgb, OdometryFramePyramidType::PYR_IMAGE, 0); | ||
| } | ||
| else | ||
| { | ||
| Affine3f affine; | ||
| Matx44d mrt; | ||
| Mat Rt; | ||
| icp.prepareFrames(newFrame, prevFrame); | ||
| bool success = icp.compute(newFrame, prevFrame, Rt); | ||
| if (!success) | ||
| return false; | ||
| affine.matrix = Matx44f(Rt); | ||
| pose = (Affine3f(pose) * affine).matrix; | ||
| float rnorm = (float)cv::norm(affine.rvec()); | ||
| @@ -304,23 +308,24 @@ bool ColoredKinFuImpl<MatType>::updateT(const MatType& _depth, const MatType& _r | ||
| { | ||
| // use depth instead of distance | ||
| volume->integrate(depth, rgb, params.depthFactor, pose, params.intr, params.rgb_intr); | ||
| newFrame.setPyramidLevel(params.icpIterations.size(), OdometryFramePyramidType::PYR_IMAGE); | ||
| newFrame.setPyramidAt(rgb, OdometryFramePyramidType::PYR_IMAGE, 0); | ||
| } | ||
| MatType points, normals, colors; | ||
| newFrame.getPyramidAt(points, OdometryFramePyramidType::PYR_CLOUD, 0); | ||
| newFrame.getPyramidAt(normals, OdometryFramePyramidType::PYR_NORM, 0); | ||
| newFrame.getPyramidAt(colors, OdometryFramePyramidType::PYR_IMAGE, 0); | ||
| volume->raycast(pose, params.intr, params.frameSize, points, normals, colors); | ||
| newFrame.setPyramidAt(points, OdometryFramePyramidType::PYR_CLOUD, 0); | ||
| newFrame.setPyramidAt(normals, OdometryFramePyramidType::PYR_NORM, 0); | ||
| newFrame.setPyramidAt(colors, OdometryFramePyramidType::PYR_IMAGE, 0); | ||
| } | ||
| renderFrame = newFrame; | ||
| prevFrame = newFrame; | ||
| frameCounter++; | ||
| return true; | ||
| } | ||
| @@ -331,9 +336,10 @@ void ColoredKinFuImpl<MatType>::render(OutputArray image) const | ||
| { | ||
| CV_TRACE_FUNCTION(); | ||
| MatType pts, nrm, rgb; | ||
| renderFrame.getPyramidAt(pts, OdometryFramePyramidType::PYR_CLOUD, 0); | ||
| renderFrame.getPyramidAt(nrm, OdometryFramePyramidType::PYR_NORM, 0); | ||
| renderFrame.getPyramidAt(rgb, OdometryFramePyramidType::PYR_IMAGE, 0); | ||
| detail::renderPointsNormalsColors(pts, nrm, rgb, image); | ||
| } | ||
Uh oh!
There was an error while loading.Please reload this page.