Skip to content

Commit 4f5a73d

Browse files
authored
Merge pull request andyzeng#16 from yenchenlin/fix-weight-bug
fix gpu version too, tested!
2 parents d1797e0 + 921e847 commit 4f5a73d

File tree

1 file changed

+4
-4
lines changed

1 file changed

+4
-4
lines changed

fusion.py

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -123,7 +123,7 @@ def __init__(self, vol_bnds, voxel_size, use_gpu=True):
123123
float obs_weight = other_params[5];
124124
float w_new = w_old + obs_weight;
125125
weight_vol[voxel_idx] = w_new;
126-
tsdf_vol[voxel_idx] = (tsdf_vol[voxel_idx]*w_old+dist)/w_new;
126+
tsdf_vol[voxel_idx] = (tsdf_vol[voxel_idx]*w_old+obs_weight*dist)/w_new;
127127
// Integrate color
128128
float old_color = color_vol[voxel_idx];
129129
float old_b = floorf(old_color/(256*256));
@@ -133,9 +133,9 @@ def __init__(self, vol_bnds, voxel_size, use_gpu=True):
133133
float new_b = floorf(new_color/(256*256));
134134
float new_g = floorf((new_color-new_b*256*256)/256);
135135
float new_r = new_color-new_b*256*256-new_g*256;
136-
new_b = fmin(roundf((old_b*w_old+new_b)/w_new),255.0f);
137-
new_g = fmin(roundf((old_g*w_old+new_g)/w_new),255.0f);
138-
new_r = fmin(roundf((old_r*w_old+new_r)/w_new),255.0f);
136+
new_b = fmin(roundf((old_b*w_old+obs_weight*new_b)/w_new),255.0f);
137+
new_g = fmin(roundf((old_g*w_old+obs_weight*new_g)/w_new),255.0f);
138+
new_r = fmin(roundf((old_r*w_old+obs_weight*new_r)/w_new),255.0f);
139139
color_vol[voxel_idx] = new_b*256*256+new_g*256+new_r;
140140
}""")
141141

0 commit comments

Comments
 (0)