Skip to content

Commit 64a4bf1

Browse files
committed
roughly working, need coarse-to-fine
1 parent 98d4cdf commit 64a4bf1

File tree

3 files changed

+20
-11
lines changed

3 files changed

+20
-11
lines changed

examples/Cuda/Experiment/RegisterRGBDToTSDFVolume.cpp

+18-8
Original file line numberDiff line numberDiff line change
@@ -56,7 +56,9 @@ int main(int argc, char **argv) {
5656
(float)config.tsdf_truncation_, trans, 40000, 60000);
5757
cuda::RGBDImageCuda rgbd((float)config.max_depth_,
5858
(float)config.depth_factor_);
59-
for (int i = begin; i < end; ++i) {
59+
60+
Eigen::Matrix4d pose, prev_pose;
61+
for (int i = begin; i < begin + 13; ++i) {
6062
utility::LogInfo("Integrating frame {} ...", i);
6163

6264
Image depth, color;
@@ -65,15 +67,23 @@ int main(int argc, char **argv) {
6567
rgbd.Upload(depth, color);
6668

6769
/* Use ground truth trajectory */
68-
Eigen::Matrix4d pose = pose_graph.nodes_[i - begin].pose_;
69-
trans.FromEigen(pose);
70-
71-
tsdf_volume.Integrate(rgbd, intrinsic, trans);
70+
if (i - begin <= 10) {
71+
pose = pose_graph.nodes_[i - begin].pose_;
72+
trans.FromEigen(pose);
73+
} else {
74+
trans.FromEigen(prev_pose);
75+
auto result =
76+
RGBDToTSDFRegistration(rgbd, tsdf_volume, intrinsic, trans);
77+
pose = std::get<1>(result);
78+
trans.FromEigen(pose);
7279

73-
if (i > 10) {
74-
RGBDToTSDFRegistration(rgbd, tsdf_volume, intrinsic, trans);
75-
break;
80+
std::cout << "------\n";
81+
std::cout << pose << "\n";
82+
std::cout << pose_graph.nodes_[i - begin].pose_ << "\n";
83+
std::cout << "------\n";
7684
}
85+
tsdf_volume.Integrate(rgbd, intrinsic, trans);
86+
prev_pose = pose;
7787
}
7888

7989
tsdf_volume.GetAllSubvolumes();

src/Cuda/Integration/RGBDToTSDF.cpp

+1-2
Original file line numberDiff line numberDiff line change
@@ -20,7 +20,7 @@ std::tuple<bool, Eigen::Matrix4d, float> RGBDToTSDFRegistration(
2020
Eigen::Matrix4d cam_to_world = transform_camera_to_world.ToEigen();
2121
Eigen::Matrix4d delta;
2222

23-
for (int iter = 0; iter < 3; ++iter) {
23+
for (int iter = 0; iter < 200; ++iter) {
2424
linear_system.Memset(0);
2525
transform_camera_to_world.FromEigen(cam_to_world);
2626

@@ -32,7 +32,6 @@ std::tuple<bool, Eigen::Matrix4d, float> RGBDToTSDFRegistration(
3232

3333
utility::LogInfo("> Iter {}: loss = {}, avg loss = {}, inliers = {}",
3434
iter, loss, loss / inliers, inliers);
35-
std::cout << cam_to_world << "\n";
3635

3736
std::tie(is_success, delta) =
3837
utility::SolveJacobianSystemAndObtainExtrinsicMatrix(JtJ, Jtr);

src/Cuda/Integration/RGBDToTSDFKernel.cuh

+1-1
Original file line numberDiff line numberDiff line change
@@ -103,7 +103,7 @@ __global__ void BuildLinearSystemRGBDToTSDFKernel(
103103
/** Reduce Sum loss and inlier **/
104104
const int OFFSET2 = 27;
105105
{
106-
local_sum0[tid] = mask ? residual : 0;
106+
local_sum0[tid] = mask ? residual * residual : 0;
107107
local_sum1[tid] = mask ? 1 : 0;
108108
__syncthreads();
109109

0 commit comments

Comments
 (0)