Enhance RANSAC Alignment with Inliers, Keypoint Pairs, and Alignment Time Visualization #48
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.
PR Summary
This PR introduces several improvements to the map closure process, focusing on the RANSAC alignment, visualization of keypoint pairs and inliers, and performance tracking.
Key Changes
1. Return Inliers Instead of Number of Inliers in
RansacAlignment2D
RansacAlignment2D
now returns a pair containing the alignment transform (Eigen::Isometry2d
) and a list of inlier point pairs instead of just the number of inliers. This change allows for more detailed information about the inliers during the map closure process.2. Updated
ClosureCandidate
StructClosureCandidate
struct has been updated to store additional information, including:keypoint_pairs
: A vector of keypoint pairs used in the alignment.inliers
: A vector of inlier keypoint pairs.alignment_time
: The time taken to perform the alignment in milliseconds.3. Updated Map Closures Processing
MapClosures::ValidateClosure
function now measures the time taken for RANSAC alignment and records the keypoint pairs and inliers for each closure. This data is stored in theClosureCandidate
struct and used for further visualization and analysis.4. Enhanced Python API
The Python API has been updated to handle the new structure of the
ClosureCandidate
and pass additional information such as keypoint pairs, inliers, and alignment time to the visualization layer.The
MapClosurePipeline
class now passesnumber_of_inliers
,alignment_time
,keypoint_pairs
, andinliers
to the visualizer.5. Visualization Improvements
The
ClosuresVisualizer
class has been enhanced to visualize inliers and keypoint pairs in the density map viewer. The user can now toggle the visibility of outliers through a new tool (ToggleOutliersTool
), and inliers and outliers are displayed with different colors and markers for easier identification.The alignment time is displayed in the title of the plot, and users can see the time taken for each alignment and the number of inliers.
6. New Outliers Toggle Tool
ToggleOutliersTool
) has been added to allow toggling the visibility of outliers in the visualizer. This feature is useful for debugging and analyzing the quality of the alignment.Additional Files and Changes
outliers.png
) has been added for the outliers toggle button.map_closures_pybind.cpp
file has been updated to expose the newClosureCandidate
fields (keypoint_pairs
,inliers
,alignment_time
) to Python.How to Test
Build and Run the Project:
Check the Output:
Use the Visualizer:
Python Pipeline:
Motivation
These changes were made to provide more transparency into the alignment process by exposing additional data, including the time taken for the alignment and the specific keypoints used in the alignment. The ability to toggle and visualize outliers will help with debugging and improving the accuracy of the map closure algorithm.