-
-
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
Model outlier removal contribution #702
Conversation
|
||
//////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////// | ||
template <typename PointT> bool | ||
pcl::ModelOutlierRemoval<PointT>::initSACModel (int model_type) |
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 would rather be specific and use the SacModel
enum instead of int
here.
@jspricke Should we remove |
|
||
This tutorial demonstrates how to extract parametric models for example for planes or spheres | ||
out of a PointCloud by using SAC_Models with known coefficients. | ||
If you don't know the models coefficients take a look at the Sample Consensus tutorials. |
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.
Would be nice to have a link here and in the previous line.
Hi Victor, thanks for taking care of this abandoned pull request. I think it might be appropriate to deviate a bit from our usual rule of squashing commits and leave the original contribution of Timo as is, adding modifications in separate commit(s) on top of it. |
/** \brief returns the models coefficients | ||
*/ | ||
pcl::ModelCoefficients | ||
getModelCoefficients () |
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.
We usually mark getter functions with const
modifier.
@taketwo Regarding PCLPointCloud2, I'm still in favor of deprecating it at some point (or rather have a new, more capable, point type in the future). My point was that this patch contains two identical (didn't check) copies of Regarding cleaning up Timos contribution, I would propose to adopt Something like the kernel guidelines [1] or [2]. [1] http://git.kernel.org/cgit/linux/kernel/git/torvalds/linux.git/tree/Documentation/SubmittingPatches?id=4e8a2372f9255a1464ef488ed925455f53fbdaa1#n286 |
Do you mean that you would rather see a single commit with an attribution to Victor in the commit message? I think in this case quite a number of changes are being made on top of the original one, and it's easier to digest them as several commits.
I'm a PCL user since 2012, but I never had a necessity to use a specialization of any class for |
No: So as I understand it, you add a comment to the commit message stating |
@TimoHackel do not seem very active on GitHub and never wrote a
I'll will delete |
@VictorLamoine I guess it should be enough to add your |
Still I don't get what are the cons for just leaving the original commit as is (like if it was merged), and then putting the updates on top? |
@taketwo It's the same as with all other style changes, you are changing the author of the code and it's making the commit history harder to read. |
That is true. On the other hand, in this case Victor stood up to take care of an abandoned code. Even though he is not the original author, he took the responsibility of cleaning up and integrating the contribution in PCL. Therefore, if the fabulous git blame returns his name, it makes perfect sense to me. Furthermore I suspect Timo would be surprised if he is held responsible for the code that he did not care enough to integrate and that was also modified by someone else. |
True, we are not the kernel community, so I'm ok with doing separate commits. |
Ok fine. Otherwise I think the code is now pretty clean and matches the PCL style guide ! |
Sorry I overlooked your comment. The syntax is correct, however it would be nicer to use a typedef that is already present within the class: The errors you get are anticipated. Boost shared pointer is "similar" to a plain pointer, but does not have exactly the same semantics. I would strongly recommend you to get acquainted with this, since smart pointers are an essential tool in modern C++. This short article may get you started. |
Hi, Anyways, it would be nicer to remove that pointer completely and try a type casts instead. |
Why do we need custom delete functions? Won't something like this work? case SACMODEL_NORMAL_PLANE:
{
PCL_DEBUG ("[pcl::%s::segment] Using a model of type: modelNORMAL_PLANE\n", getClassName ().c_str ());
model_from_normals_.reset (new SampleConsensusModelNormalPlane<PointT, pcl::Normal> (input_));
model_ = model_from_normals_;
break;
} |
I don't think so. There's no inheritance between type of model_ and type of model_from_normals_ (compare: https://github.com/PointCloudLibrary/pcl/blob/master/sample_consensus/include/pcl/sample_consensus/sac_model.h#L557 ). Hence, model_ = model_from_normals_ will fail. |
I don't understand how I could remove the What do we do here ? I'm far from being a C++ expert and you quite lost me here :) |
I would remove the member
b)
(not tested and a typedef for |
Thank you for your help! It compiles fine by my side with gcc and the test unit is ok. |
initSACModel (pcl::SacModel model_type); | ||
}; | ||
} | ||
|
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.
We need a conditional include of the implementation file here for the "no precompilation" option:
#ifdef PCL_NO_PRECOMPILE
#include <pcl/filters/impl/model_outlier_removal.hpp>
#endif
#include <pcl/sample_consensus/sac_model_parallel_line.h> | ||
#include <pcl/sample_consensus/sac_model_perpendicular_plane.h> | ||
#include <pcl/sample_consensus/sac_model_plane.h> | ||
#include <pcl/sample_consensus/sac_model_sphere.h> |
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 would move as many of these model includes as possible to the implementation file. The user of this class might want only a single model, no need to pull in all the existing model headers.
The reason why the compilation succeeds on your machine is because you did not enable When this option is on, consensus models are instantiated only for a subset of XYZ point types. Our new class is instantiated for all XYZ point types unconditionally. Therefore to circumvent the problem we need to instantiate #ifdef PCL_ONLY_CORE_POINT_TYPES
PCL_INSTANTIATE (ModelOutlierRemoval, (pcl::PointXYZ)(pcl::PointXYZI)(pcl::PointXYZRGBA)(pcl::PointXYZRGB))
#else
PCL_INSTANTIATE (ModelOutlierRemoval, PCL_XYZ_POINT_TYPES)
#endif |
Thanks for your work and help. The pull request #254 is now closed. |
@taketwo: I think it is good to merge, is it ? |
{ | ||
PCL_DEBUG ("[pcl::%s::segment] Using a model of type: modelCYLINDER\n", getClassName ().c_str ()); | ||
SampleConsensusModelCylinder<PointT, pcl::Normal> *ptr = new SampleConsensusModelCylinder<PointT, pcl::Normal> (input_); | ||
model_.reset (ptr); |
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 we can merge pointer creation and reset()
in a single instruction? And in the subsequent cases as well.
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, it was there before because of model_from_normals_
but now the ptr
pointer is useless.
@VictorLamoine I don't think so :) |
|
||
/** \brief Set to true if we want to return the data outside the interval specified by setFilterLimits (min, max) | ||
* Default: false. | ||
* \warning This method will be removed in the future. Use setNegative() instead. |
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 wonder why we are introducing a brand new class with to-be-removed functions. We are committing to this interface, let's not pollute it.
Signed-off-by: Victor Lamoine <victor.lamoine@gmail.com>
Thanks for working on this Victor! |
Model outlier removal contribution
Finally 🎉 |
Is it the good way to update @TimoHackel's contribution #254 ?
_
suffix)single_threshold
method:checkSingleThreshold
SacModel
enum instead ofint
getThreshhold
typoconst
modifiermodel_from_normals_
class memberPCLPointCloud2
specializationpcl::isFinite
instead ofpcl_isfinite
cloud_normals_
into aConstPtr
getFilterLimitsNegative
andsetFilterLimitsNegative