-
-
Notifications
You must be signed in to change notification settings - Fork 4.6k
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 GASD global point cloud descriptor #1652
Conversation
Thanks for you contribution. As this is new feature it might takes us a while to start reviewing it, especially considering the goals for our next release. In the meantime, there are importing things we'll need from your side. Unit tests (mandatory)I've noticed you haven't submitted any unit tests with your code, although I'm sure you must have used something to validade its output. Could you please submit that as well. Tutorial (optional)Although not required, it would be great if you could submit also a tutorial similar to this, briefly explaining the theoretical primer and showing a simple use case. It really helps to promote your contribution as users tend to explore the tutorials, not really the repository. Once more, thanks for this 👍 |
Ok, I'll work on this material and I'll let you know once I've finished. Thanks. |
I've just added some unit tests. |
Thanks. The test is segfaulting. I'm assuming it was not happening on your environment. Which OS, compiler are you using? |
I'm using Windows and Visual C++. I will try to reproduce this error using gcc on Ubuntu in order to fix it. |
I've fixed the issue, now the test is passing. |
I've also added a tutorial about GASD. |
9ce29b8
to
43f71df
Compare
Great work @jpsml ! :) Thanks for all the effort. |
Hey @jpsml. Sorry for the super long delay to start reviewing this. Could you rebase the PR to the current master? Otherwise we won't be able to merge this. |
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.
Even though I have a number of comments I really appreciate your coding style @jpsml.
Thanks for contributing this.
gasd.setColorHistsInterpMethod (gasd.INTERP_NONE); | ||
|
||
// Output datasets | ||
pcl::PointCloud<pcl::GASDSignature984>::Ptr descriptor (new pcl::PointCloud<pcl::GASDSignature984>); |
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.
Why are you creating an shared_ptr here if then you only use the dereferenced version in gasd.compute()
?
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've tried to follow the same standard of the VFH, PFH, FPFH and Normal estimation tutorials. Do you think I should change this?
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.
Yes.
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.
Solved
|
||
// Get the alignment transform | ||
Eigen::Matrix4f trans; | ||
gasd.getTransform (trans); |
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.
(Comment to) Self: I'll probably request to revise upon definition of the actual method.
gasd.setShapeHistsInterpMethod (gasd.INTERP_TRILINEAR); | ||
|
||
// Output datasets | ||
pcl::PointCloud<pcl::GASDSignature512>::Ptr descriptor (new pcl::PointCloud<pcl::GASDSignature512>); |
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.
Same comment as above.
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've tried to follow the same standard of the VFH, PFH, FPFH and Normal estimation tutorials. Do you think I should change this?
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.
Yes
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.
Solved
|
||
// Get the alignment transform | ||
Eigen::Matrix4f trans; | ||
gasd.getTransform (trans); |
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.
Self: Same comment as before.
features/include/pcl/features/gasd.h
Outdated
* Software License Agreement (BSD License) | ||
* | ||
* Point Cloud Library (PCL) - www.pointclouds.org | ||
* Copyright (c) 2014-, Open Perception, Inc. |
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.
This should only be
Copyright (c) 2016-, Open Perception, Inc.
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.
Solved
PointXYZRGBA p; | ||
p.x = cloud.points[i].x; | ||
p.y = cloud.points[i].y; | ||
p.z = cloud.points[i].z; |
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.
p.getVectorMap3f () = cloud[i].getVectorMap3f()
TEST (PCL, GASDShapeAndColorEstimationNoInterp) | ||
{ | ||
// Create fake point cloud with colors | ||
PointCloud<PointXYZRGBA> cloudWithColors; |
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.
define it as shared_ptr
|
||
p.rgba = ((i % 255) << 16) + (((255 - i) % 255) << 8) + ((i * 37) % 255); | ||
cloudWithColors.push_back (p); | ||
} |
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.
This is the same code as before, why not define a function to do it on top of the file.
|
||
using namespace pcl; | ||
using namespace pcl::io; | ||
using namespace std; |
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.
Please remove using namespace
and use only the symbols you need.
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.
Solved
* Software License Agreement (BSD License) | ||
* | ||
* Point Cloud Library (PCL) - www.pointclouds.org | ||
* Copyright (c) 2014-, Open Perception, Inc. |
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.
Copyright (c) 2016-, Open Perception, Inc.
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.
Solved
|
||
////////////////////////////////////////////////////////////////////////////////////////////// | ||
template <typename PointInT, typename PointOutT> void | ||
GASDEstimation<PointInT, PointOutT>::addSampleToHistograms (Eigen::Vector4f &p, |
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.
Forgot to add that p
can be defined const.
Before getting into implementation details, I'd like to understand what is the relation between the size of the descriptor and the principal parameters of the method. Why there are only three possible descriptor sizes? What happens if the user chose descriptor size that does not play well with the parameters? Could it be that a base class + three deriving classes each with fixed output descriptor size will better capture the structure of your algorithm? |
Thanks for the feedback, @SergioRAgostinho and @taketwo. I'll work on your comments and get back to you soon. |
Replying to @taketwo: if the user chooses a descriptor size that does not play well with the parameters, it will crash. Let me check if I understood your idea: the user would be able to instantiate the derived classes with suggested configurations or to instantiate the base class if he/she wants to use a different configuration. Is this what you meant? |
Sorry for the delay, I've been out of town last week. I meant having different classes implementing the |
Replying to @taketwo: now I'm sorry for the delay, the last weeks were very busy. I think it will be better to follow your suggestion of having two different classes. I'm thinking about naming them ShapeGASDEstimation and ShapeColorGASDEstimation. Thanks. |
@jpsml Please STOP writing "Solved" for every comment! This floods our mailboxes! |
…ndentation and change hue calculation to avoid division by zero
Thank you for all your hard work. I think this it it :) |
Should I squash the commits? |
No need. We can do it ourselves. |
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, here is the last (promise) batch of comments, all are minor. Once addressed, let's merge and celebrate!
struct GASDSignature512 | ||
{ | ||
float histogram[512]; | ||
static int descriptorSize() { return 512; } |
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.
Missing space here and other signature structs.
features/include/pcl/features/gasd.h
Outdated
* \param[out] trans transformation | ||
*/ | ||
const Eigen::Matrix4f& | ||
getTransform () |
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.
const
features/include/pcl/features/gasd.h
Outdated
size_t color_hists_size_; | ||
|
||
/** \brief Interpolation method to be used while computing the color descriptor. */ | ||
typename HistogramInterpolationMethod color_interp_; |
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 don't think typename
is necessary here.
|
||
#include <vector> | ||
|
||
namespace pcl |
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.
In most (maybe all) of PCL we don't use namespace block in implementation files. Instead, each method name is prefixed with pcl::
and no indentation is needed. I'd suggest we stick with this tradition.
return; | ||
} | ||
|
||
// Resize the output dataset |
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.
Simply output.resize (1)
, will take care of width and height.
const Eigen::Vector3f centroid_xyz = centroid.head<3> (); | ||
|
||
// compute alignment transform from axes and centroid | ||
transform_ << x_axis.transpose(), -x_axis.dot (centroid_xyz), |
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.
Missing spaces
} | ||
|
||
// compute histograms bins indices | ||
const Eigen::Vector4f bins (floor (coords[0]), floor (coords[1]), floor (coords[2]), floor (coords[3])); |
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.
Please prefix with std
, i.e. std::floor
.
Offtopic: Sergio, what do you mean when you add label "ready to merge"? How is it different from "approved" status? |
I think we created it before the review system with status was in place. Before we used it to signal PRs which had to be held off from merging till the next minor release, but that were already good merge. Now even though the review status system does the same, it's just visual sugar, making easier to see on the PR list. |
Agree to such use and visual sugar as well, it's indeed more noticeable in the PR list. However, in this particular situation, I'm still not sure what is the message that you send by labeling as "ready to merge". If it is ready to merge, the why don't you merge? We have no release constraints. |
It is that, as a reviewer I believe this is ready to merge, but I still want a second maintainer to do a final check and merge it. Basically I'm requesting for a second validation. |
I see... but then it's not ready to merge yet! I think "status: needs review" is more appropriate. Github also allows you to formally request a review from me. |
👍 will do |
Gjob guys :) Thank your for your contributions @jpsml and for enduring with us through the multiple stages of this thing ^^ |
I've just commited an extension to the tutorial. |
Thanks. You need to open a new PR with the extension you just added. After a PR |
Created PR #2167. |
The Globally Aligned Spatial Distribution (GASD) descriptor for point clouds with XYZ data (and optionally RGB data) is presented in the paper:
"An Efficient Global Point Cloud Descriptor for Object Recognition and Pose Estimation", J. Lima and V. Teichrieb, SIBGRAPI 2016 - Conference on Graphics, Patterns and Images, São José dos Campos, Brazil.
The paper is available at: http://www.cin.ufpe.br/~jpsml/uploads/8/2/6/7/82675770/pid4349755.pdf