Because your voxel coordinates represent voxel centers, i.e. they're projected directly onto the image and then rounded to get the depth, your actual hash blocks actually start with a 1/2 voxel offset from the whole coordinate.
You don't take this into account when allocating hash blocks, which results in missing blocks in certain situations and contributes drift/noise. The easy fix is to add the offset to the segment along camera ray that's marched on during hash block allocation.
Simply replace these lines:
|
pt_buff = pt_camera_f * (1.0f - mu / norm); pt_buff.w = 1.0f; |
|
point = TO_VECTOR3(invM_d * pt_buff) * oneOverVoxelSize; |
|
|
|
pt_buff = pt_camera_f * (1.0f + mu / norm); pt_buff.w = 1.0f; |
|
point_e = TO_VECTOR3(invM_d * pt_buff) * oneOverVoxelSize; |
With this:
pt_buff = pt_camera_f * (1.0f - mu / norm); pt_buff.w = 1.0f;
point = TO_VECTOR3(invM_d * pt_buff) * oneOverVoxelSize + Vector3f(1.0f / (2.0f * VOXEL_BLOCK_SIZE));
pt_buff = pt_camera_f * (1.0f + mu / norm); pt_buff.w = 1.0f;
point_e = TO_VECTOR3(invM_d * pt_buff) * oneOverVoxelSize + Vector3f(1.0f / (2.0f * VOXEL_BLOCK_SIZE));
Also, your variable names could be a bit more descriptive and not use acronyms, and calling the inverse of hash block size in meters "oneOverVoxelSize" is misleading. I suggest "oneOverVoxelBlockSize_Meters".
Because your voxel coordinates represent voxel centers, i.e. they're projected directly onto the image and then rounded to get the depth, your actual hash blocks actually start with a 1/2 voxel offset from the whole coordinate.
You don't take this into account when allocating hash blocks, which results in missing blocks in certain situations and contributes drift/noise. The easy fix is to add the offset to the segment along camera ray that's marched on during hash block allocation.
Simply replace these lines:
InfiniTAM/InfiniTAM/ITMLib/Engines/Reconstruction/Shared/ITMSceneReconstructionEngine_Shared.h
Lines 202 to 206 in 4156547
With this:
Also, your variable names could be a bit more descriptive and not use acronyms, and calling the inverse of hash block size in meters "oneOverVoxelSize" is misleading. I suggest "oneOverVoxelBlockSize_Meters".