Unified cloud initializer pipeline for ICP (fixes segfault colored ICP) #6942
+152
−43
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Type
Motivation and Context
The
RegistrationICP
function can be used to perform point-to-point ICP, point-to-plane ICP, generalized ICP, or colored ICP. Additionally, there are specific functions,RegistrationGeneralizedICP
andRegistrationColoredICP
, for computing generalized ICP and colored ICP only, respectively. These functions are simple wrappers aroundRegistrationICP
: they initialize the point clouds for the specific ICP algorithm (e.g., computing color gradients for colored ICP) and then call theRegistrationICP
function with the modified point clouds.However, this point cloud initialization is skipped if you directly call the
RegistrationICP
function to compute generalized ICP or colored ICP because the initialization is only performed in the wrapper functions. While this is not a significant issue for generalized ICP, it causes a segmentation fault for colored ICP, as the target point cloud must be initialized as an instance ofPointCloudForColoredICP
to compute the additionalcolor_gradients_
values.Checklist:
python util/check_style.py --apply
to apply Open3D code styleto my code.
updated accordingly.
results (e.g. screenshots or numbers) here.
Description
This PR introduces a unified point cloud initialization pipeline. A new virtual function,
InitializePointCloudsForTransformation
, is added to theTransformationEstimation
class. This function is overridden in derived classes to handle the specific initialization required for each specific ICP algorithm, and is being called at the beginning of theRegistrationICP
function.This fixes the segmentation fault that occurs when calling
RegistrationICP
for colored ICP, because now the target point cloud will be correctly initialized with thecolor_gradient_
values. It also allowsRegistrationICP
to compute generalized ICP with point clouds that don't have pre-computed normals. Previously, this was only possible by calling theRegistrationGeneralizedICP
wrapper, which exclusively handled the initialization of the point clouds.With this change the point clouds are correctly and consistently initialized across the different ICP algorithms, regardless of whether the user directly calls
RegistrationICP
or a specialized wrapper function likeRegistrationColoredICP
.Testing
Before
After