Skip to content
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

Merged
merged 7 commits into from
Dec 1, 2017

Conversation

jpsml
Copy link
Contributor

@jpsml jpsml commented Jul 16, 2016

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

@SergioRAgostinho
Copy link
Member

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 👍

@jpsml
Copy link
Contributor Author

jpsml commented Jul 18, 2016

Ok, I'll work on this material and I'll let you know once I've finished. Thanks.

@jpsml
Copy link
Contributor Author

jpsml commented Aug 1, 2016

I've just added some unit tests.

@SergioRAgostinho
Copy link
Member

Thanks. The test is segfaulting. I'm assuming it was not happening on your environment. Which OS, compiler are you using?

@jpsml
Copy link
Contributor Author

jpsml commented Aug 1, 2016

I'm using Windows and Visual C++. I will try to reproduce this error using gcc on Ubuntu in order to fix it.

@jpsml
Copy link
Contributor Author

jpsml commented Aug 3, 2016

I've fixed the issue, now the test is passing.

@jpsml
Copy link
Contributor Author

jpsml commented Aug 8, 2016

I've also added a tutorial about GASD.

@jpsml jpsml force-pushed the gasd branch 2 times, most recently from 9ce29b8 to 43f71df Compare August 8, 2016 00:29
@SergioRAgostinho
Copy link
Member

Great work @jpsml ! :) Thanks for all the effort.

@SergioRAgostinho SergioRAgostinho added this to the pcl-1.9.0 milestone Aug 9, 2016
@SergioRAgostinho SergioRAgostinho added the needs: code review Specify why not closed/merged yet label Aug 9, 2016
@SergioRAgostinho
Copy link
Member

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.

@SergioRAgostinho SergioRAgostinho self-assigned this Jul 5, 2017
Copy link
Member

@SergioRAgostinho SergioRAgostinho left a 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>);
Copy link
Member

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()?

Copy link
Contributor Author

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?

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yes.

Copy link
Contributor Author

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);
Copy link
Member

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>);
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Same comment as above.

Copy link
Contributor Author

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?

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yes

Copy link
Contributor Author

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);
Copy link
Member

@SergioRAgostinho SergioRAgostinho Jul 5, 2017

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.

* Software License Agreement (BSD License)
*
* Point Cloud Library (PCL) - www.pointclouds.org
* Copyright (c) 2014-, Open Perception, Inc.
Copy link
Member

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.

Copy link
Contributor Author

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;
Copy link
Member

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;
Copy link
Member

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);
}
Copy link
Member

@SergioRAgostinho SergioRAgostinho Jul 5, 2017

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;
Copy link
Member

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.

Copy link
Contributor Author

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.
Copy link
Member

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.

Copy link
Contributor Author

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,
Copy link
Member

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.

@SergioRAgostinho SergioRAgostinho added needs: author reply Specify why not closed/merged yet and removed needs: code review Specify why not closed/merged yet labels Jul 5, 2017
@taketwo
Copy link
Member

taketwo commented Jul 5, 2017

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?

@jpsml
Copy link
Contributor Author

jpsml commented Jul 7, 2017

Thanks for the feedback, @SergioRAgostinho and @taketwo. I'll work on your comments and get back to you soon.

@SergioRAgostinho
Copy link
Member

@jpsml don't forget about @taketwo 's question. It's way more important to go through that reasoning now, than fixing my implementation specific comments.

@jpsml
Copy link
Contributor Author

jpsml commented Jul 12, 2017

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?

@taketwo
Copy link
Member

taketwo commented Jul 17, 2017

Sorry for the delay, I've been out of town last week.

I meant having different classes implementing the Feature interface. I have not carefully studied the code and/or the paper yet, but from what I see the use of color seems to be an optional extension. So for example there may be GASDEstimation and another class ColorGASDEstimation or something like this. But this is just a thought. In general would be nice to have a simple interface so that the user does not need to be an expert and make too many decisions with a risk that everything will explode with a segfault unless he got all the parameters fitting together.

@jpsml
Copy link
Contributor Author

jpsml commented Aug 2, 2017

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.

@taketwo
Copy link
Member

taketwo commented Aug 7, 2017

@jpsml Please STOP writing "Solved" for every comment! This floods our mailboxes!
As soon as you push a commit that solves the problem, GitHub will hide the corresponding comment.

…ndentation and change hue calculation to avoid division by zero
@SergioRAgostinho SergioRAgostinho added status: ready to merge and removed needs: more work Specify why not closed/merged yet labels Nov 24, 2017
@SergioRAgostinho
Copy link
Member

Thank you for all your hard work. I think this it it :)

@jpsml
Copy link
Contributor Author

jpsml commented Nov 25, 2017

Should I squash the commits?

@SergioRAgostinho
Copy link
Member

No need. We can do it ourselves.

Copy link
Member

@taketwo taketwo left a 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; }
Copy link
Member

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.

* \param[out] trans transformation
*/
const Eigen::Matrix4f&
getTransform ()
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

const

size_t color_hists_size_;

/** \brief Interpolation method to be used while computing the color descriptor. */
typename HistogramInterpolationMethod color_interp_;
Copy link
Member

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
Copy link
Member

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
Copy link
Member

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),
Copy link
Member

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]));
Copy link
Member

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.

@taketwo
Copy link
Member

taketwo commented Nov 26, 2017

Offtopic: Sergio, what do you mean when you add label "ready to merge"? How is it different from "approved" status?

@SergioRAgostinho
Copy link
Member

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.

@taketwo
Copy link
Member

taketwo commented Nov 26, 2017

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.

@SergioRAgostinho
Copy link
Member

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.

@taketwo taketwo self-requested a review November 26, 2017 12:12
@taketwo
Copy link
Member

taketwo commented Nov 26, 2017

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.

@SergioRAgostinho
Copy link
Member

👍 will do

@SergioRAgostinho SergioRAgostinho added needs: author reply Specify why not closed/merged yet and removed status: ready to merge labels Nov 26, 2017
@SergioRAgostinho SergioRAgostinho merged commit 7c4a475 into PointCloudLibrary:master Dec 1, 2017
@SergioRAgostinho
Copy link
Member

Gjob guys :) Thank your for your contributions @jpsml and for enduring with us through the multiple stages of this thing ^^

@taketwo taketwo removed the needs: author reply Specify why not closed/merged yet label Dec 2, 2017
@SergioRAgostinho
Copy link
Member

@jpsml It would be good to tweak/extend the tutorial a little bit. The first reactions on the mailing list indicated some confusion about what to do exactly. More info here.

@jpsml
Copy link
Contributor Author

jpsml commented Dec 21, 2017

I've just commited an extension to the tutorial.

@SergioRAgostinho
Copy link
Member

SergioRAgostinho commented Dec 21, 2017

Thanks. You need to open a new PR with the extension you just added. After a PR closes is merged, GitHub no longer tracks the branch you were working on.

@jpsml
Copy link
Contributor Author

jpsml commented Dec 21, 2017

Created PR #2167.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
changelog: new feature Meta-information for changelog generation module: features
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants