-
-
Notifications
You must be signed in to change notification settings - Fork 6.7k
Add ICP support for 3d point clouds #465
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Add ICP support for 3d point clouds #465
Conversation
* icp_matching function returns R,T corresponding to 2D or 3D set of points * update_homogeneuous_matrix - general operations for translation and rotation matrixes
Hello, I have a failed check caused by another module, I wasn't working on. |
Thank you for reporting. I will try to fix in #468. Please wait. |
Rerun CI. |
It's all good for the checks. Thank you for solving that issue. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thank you for great PR!!. I have a small request. PTAL.
@@ -152,6 +148,29 @@ def main(): | |||
print("R:", R) | |||
print("T:", T) | |||
|
|||
# test for 3d point set |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I think this test for 3d point test should be separated to main(), like main_3d_point() or something. And then iterative_closest_point.py should be updated.
There is one thing that bothers me. Even if you pass 3d point cloud, the animation would be in 2d (for axis x,y). The code to visualize in 3d will be more complicated. Requiring to put if clause for 2d or 3d case, etc. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Could you please add a new test here which call main_3d_points?
One idea is we can create a new plot function for 2d points to extract these codes:
And creating a new plot function for 3d points and dispatch to call which function using a if clause. |
* Add space
* Add more spaces
* Delete spaces
Can I ask you something? I am new to this style checking. How can I do these checks on my Spyder on Windows 10 before the commits? I always have some style issues. |
So for 3d plots I divided 2d case and 3d case by if-else operator. To my mind it is least dirty. |
* remove space
This pull request introduces 1 alert when merging 56b319c into b8f28cc - view on LGTM.com new alerts:
|
Unused import concerns |
Unfortunately, there is not a way not. But I think the "runtests.sh" should do it locally. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Hi. Thank you for your patience. Maybe this is the last review. After addressed my comments, I will merge this PR. PTAL.
fig = plt.figure() | ||
ax = fig.add_subplot(111, projection='3d') |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Current implementation create a new figure for every iteration. I think it is not good.
So, I propose the figure should be clean up after initialization(see my comment below):
fig = plt.figure() | |
ax = fig.add_subplot(111, projection='3d') | |
plt.cla() |
* plot drawing in a separate function for both 2D and 3D versions * figure creating before while loop
I tried different options to make a 3d scatter be drawn on the same figure. None of them worked for me. PTAL.
|
This pull request introduces 1 alert when merging 7aa502c into 58390e7 - view on LGTM.com new alerts:
|
We also need to do something with import of |
if previous_points.shape[0] == 3: | ||
# axes = figure.axes[0] | ||
# axes.clear() | ||
figure = plt.figure() |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Does this work without figure creation in your environment?
figure = plt.figure() | |
plt.clf() |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
For 3d case in Spyder I can see only the first plot with initial point position. And it is not updating.
(Need to mention that for 2d case every single frame of optimization is displayed as a separate image, and not an updated previous)
May be this is the case for Spyder. Does it work for you without creating figure for 3d?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Yeah. In my environment (just run the script from a terminal), it works. I think creating a lot of figures is annoying. Could you try to run the script from terminal?
One more thing. I think you can run style checker locally with:
|
Calling |
Hello @AtsushiSakai , still no answer from you.
As I said at the beginning 3d plots are complicated because of a lot of non evident moments. |
I'm sorry I missed your comments.
I think 3d plot is very useful for understanding what is happening in the script and other many examples are already using 3d plot. |
I commented the part of 3d plots, so that now it works good with 2d plots. I leave the 3d part for you to modify. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM. Thank you for your patience!!
Thank you too. Please keep me in touch with when you will add 3d plot drawing. I want to see a solution that works for you. |
Reference issue
fix #464
What does this implement/fix?
Adds an implementation of code for ICP to work both for 2d and 3d point clouds.
Additional information
Make functions
icp_matching()
andupdate_homogeneous_matrix()
flexible. Depending on thecurrent_points.shape[0]
functionsvd_motion_estimation()
automatically returns the correct size forRt
,Tt
. Then, inupdate_homogeneous_matrix()
depending on their size matrixH
is formed to be 3x3 or 4x4.Test for 3d point cloud is provided. Made the same manner as tests for 2d point cloud.