Skip to content

Commit bdf24e6

Browse files
authored
Merge pull request #3388 from savuor:pytsdf_from_scratch
Connected PR in main repo: [#22925@main](opencv/opencv#22925) ### Changes `OdometryFrame` constructor signature changed to more convenient where depth goes at 1st place, RGB image at 2nd. This works better for depth-only `Odometry` algorithms. ### Pull Request Readiness Checklist See details at https://github.com/opencv/opencv/wiki/How_to_contribute#making-a-good-pull-request - [x] I agree to contribute to the project under Apache 2 License. - [x] To the best of my knowledge, the proposed patch is not based on a code under GPL or another license that is incompatible with OpenCV - [x] The PR is proposed to the proper branch - [x] There is a reference to the original bug report and related work - [x] There is accuracy test, performance test and test data in opencv_extra repository, if applicable Patch to opencv_extra has the same branch name. - [x] The feature is well documented and sample code can be built with the project CMake
1 parent 4d49ef7 commit bdf24e6

File tree

4 files changed

+11
-9
lines changed

4 files changed

+11
-9
lines changed

modules/rgbd/src/colored_kinfu.cpp

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -284,13 +284,15 @@ bool ColoredKinFuImpl<MatType>::updateT(const MatType& _depth, const MatType& _r
284284
std::vector<MatType> channels;
285285
_rgb.convertTo(rgb_tmp, COLOR_TYPE);
286286
cv::split(rgb_tmp, channels);
287+
// we use 4-channel RGB0 image
288+
// for vectorization simplicity
287289
channels.push_back(MatType::zeros(channels[0].size(), CV_32F));
288290
merge(channels, rgb);
289291
}
290292
else
291293
rgb = _rgb;
292294

293-
OdometryFrame newFrame(rgb, depth);
295+
OdometryFrame newFrame(depth, rgb);
294296

295297
if(frameCounter == 0)
296298
{
@@ -325,7 +327,7 @@ bool ColoredKinFuImpl<MatType>::updateT(const MatType& _depth, const MatType& _r
325327
volume.raycast(pose, points, normals, colors);
326328
std::vector<MatType> pch(3);
327329
split(points, pch);
328-
newFrame = OdometryFrame(colors, pch[2], noArray(), normals);
330+
newFrame = OdometryFrame(pch[2], colors, noArray(), normals);
329331
}
330332

331333
renderFrame = newFrame;

modules/rgbd/src/dynafu.cpp

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -315,7 +315,7 @@ bool DynaFuImpl<T>::updateT(const T& _depth)
315315
else
316316
depth = _depth;
317317

318-
OdometryFrame newFrame(noArray(), depth);
318+
OdometryFrame newFrame(depth);
319319

320320
//icp->prepareFrameCache(newFrame, OdometryFrame::CACHE_SRC);
321321

@@ -337,7 +337,7 @@ bool DynaFuImpl<T>::updateT(const T& _depth)
337337
renderSurface(_depthRender, _vertRender, _normRender, false);
338338
_depthRender.convertTo(estdDepth, DEPTH_TYPE);
339339

340-
OdometryFrame estdFrame(noArray(), estdDepth);
340+
OdometryFrame estdFrame(estdDepth);
341341
//icp->setDepthFactor(1.f);
342342
//icp->prepareFrameCache(estdFrame, OdometryFrame::CACHE_SRC);
343343
//icp->setDepthFactor(params.depthFactor);
@@ -360,9 +360,9 @@ bool DynaFuImpl<T>::updateT(const T& _depth)
360360
renderSurface(_depthRender, _vertRender, _normRender);
361361
_depthRender.convertTo(estdDepth, DEPTH_TYPE);
362362

363-
estdFrame = OdometryFrame(noArray(), estdDepth);
363+
estdFrame = OdometryFrame(estdDepth);
364364
icp.prepareFrame(estdFrame);
365-
//estdFrame = OdometryFrame::create(noArray(), estdDepth, noArray(), noArray(), -1);
365+
//estdFrame = OdometryFrame::create(estdDepth, noArray(), noArray(), noArray(), -1);
366366
//icp->setDepthFactor(1.f);
367367
//icp->prepareFrameCache(estdFrame, OdometryFrame::CACHE_SRC);
368368
//icp->setDepthFactor(params.depthFactor);

modules/rgbd/src/kinfu.cpp

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -258,7 +258,7 @@ bool KinFuImpl<MatType>::updateT(const MatType& _depth)
258258
else
259259
depth = _depth;
260260

261-
OdometryFrame newFrame(noArray(), depth);
261+
OdometryFrame newFrame(depth);
262262

263263
if(frameCounter == 0)
264264
{
@@ -292,7 +292,7 @@ bool KinFuImpl<MatType>::updateT(const MatType& _depth)
292292

293293
std::vector<MatType> pch(3);
294294
split(points, pch);
295-
newFrame = OdometryFrame(noArray(), pch[2], noArray(), normals);
295+
newFrame = OdometryFrame(pch[2], noArray(), noArray(), normals);
296296
}
297297

298298
renderFrame = newFrame;

modules/rgbd/src/large_kinfu.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -321,7 +321,7 @@ bool LargeKinfuImpl<MatType>::updateT(const MatType& _depth)
321321
else
322322
depth = _depth;
323323

324-
OdometryFrame newFrame(noArray(), depth);
324+
OdometryFrame newFrame(depth);
325325

326326
CV_LOG_INFO(NULL, "Current frameID: " << frameCounter);
327327
for (const auto& it : submapMgr->activeSubmaps)

0 commit comments

Comments
 (0)