Problem accessing setInputNormals() function in SpinImageEstimation

classic Classic list List threaded Threaded
12 messages Options
Reply | Threaded
Open this post in threaded view
|

Problem accessing setInputNormals() function in SpinImageEstimation

Maxime Latulippe
Hi,

There is something going wrong when using a pointer to a SpinImageEstimation object, or at least, I didn't understand how to use it correctly. The following code doesn't compile:

typedef pcl::SpinImageEstimation<pcl::PointXYZ, pcl::Normal, pcl::Histogram<153> > SpinImageEstimation;
typedef typename SpinImageEstimation::Ptr SpinImageEstimationPtr;

SpinImageEstimationPtr spin_images(new SpinImageEstimation(8, 0.5, 16));
spin_images->setInputCloud (cloud);
spin_images->setInputNormals(normals);               <---- compile error :
spin_images->setSearchMethod (searchTree);
spin_images->setRadiusSearch (0.2);
spin_images->compute (*spinImages);

I get the error: "class [...] has no member named 'setInputNormals'." The problem does not occur when instantiating the SpinImageEstimation object directly (i.e not a pointer).

Maxime Latulippe
Master student, Laval University (Quebec)
Reply | Threaded
Open this post in threaded view
|

Re: Problem accessing setInputNormals() function in SpinImageEstimation

Radu B Rusu
Administrator
What type is normals? Please post all the relevant code ;)

Cheers,
Radu.

On 06/11/2012 02:29 PM, Maxime Latulippe wrote:

> Hi,
>
> There is something going wrong when using a pointer to a SpinImageEstimation
> object, or at least, I didn't understand how to use it correctly. The
> following code doesn't compile:
>
> typedef pcl::SpinImageEstimation<pcl::PointXYZ, pcl::Normal,
> pcl::Histogram&lt;153>  >  SpinImageEstimation;
> typedef typename SpinImageEstimation::Ptr SpinImageEstimationPtr;
>
> SpinImageEstimationPtr spin_images(new SpinImageEstimation(8, 0.5, 16));
> spin_images->setInputCloud (cloud);
> spin_images->setInputNormals(normals);<---- compile error :
> spin_images->setSearchMethod (searchTree);
> spin_images->setRadiusSearch (0.2);
> spin_images->compute (*spinImages);
>
> I get the error: "class [...] has no member named 'setInputNormals'." The
> problem does not occur when instantiating the SpinImageEstimation object
> directly (i.e not a pointer).
>
> Maxime Latulippe
> Master student, Laval University (Quebec)
>
> --
> View this message in context: http://www.pcl-users.org/Problem-accessing-setInputNormals-function-in-SpinImageEstimation-tp4019238.html
> Sent from the Point Cloud Library (PCL) Users mailing list archive at Nabble.com.
> _______________________________________________
> [hidden email] / http://pointclouds.org
> http://pointclouds.org/mailman/listinfo/pcl-users
_______________________________________________
[hidden email] / http://pointclouds.org
http://pointclouds.org/mailman/listinfo/pcl-users
Reply | Threaded
Open this post in threaded view
|

Re: Problem accessing setInputNormals() function in SpinImageEstimation

Maxime Latulippe
Here is a file containing the code.
test.cpp

Maxime
Reply | Threaded
Open this post in threaded view
|

Re: Problem accessing setInputNormals() function in SpinImageEstimation

Maxime Latulippe
Similar problem with ShapeContext3DEstimation. Am I missing something?

THIS COMPILES:
pcl::ShapeContext3DEstimation<pcl::PointXYZ, pcl::Normal, pcl::ShapeContext> sc3d_est;
sc3d_est.setInputCloud(*cloud);
sc3d_est.setInputNormals(normals);
sc3d_est.setSearchMethod(searchTree);
sc3d_est.setAzimuthBins(12);
sc3d_est.setElevationBins(12);
sc3d_est.setRadiusBins(15);
sc3d_est.setMinimalRadius(0.001);
sc3d_est.setPointDensityRadius(0.002);

THIS DOES NOT:
pcl::ShapeContext3DEstimation<pcl::PointXYZ, pcl::Normal, pcl::ShapeContext>::Ptr sc3d_est;     // using Ptr
sc3d_est->setInputCloud(*cloud);
sc3d_est->setInputNormals(normals);
sc3d_est->setSearchMethod(searchTree);
sc3d_est->setAzimuthBins(12);     <--- compile error  : "[...] has no member named setAzimuthBins"
sc3d_est->setElevationBins(12);     <--- compile error
sc3d_est->setRadiusBins(15);     <--- compile error
sc3d_est->setMinimalRadius(0.001);     <--- compile error
sc3d_est->setPointDensityRadius(0.002);     <--- compile error

Maxime
Reply | Threaded
Open this post in threaded view
|

Re: Problem accessing setInputNormals() function in SpinImageEstimation

Allan Zelener
I believe the problem is that SpinImageEstimation::Ptr is a typedef for a boost shared_ptr of the Feature base class, which does not have a setInputNormals method.

Similarly ShapeContext3DEstimation::Ptr is a typedef for the FeatureFromNormals base class, so it has the setInputNormals method but not the other feature specific methods.

As a workaround you can use something like this:

typedef boost::shared_ptr<SpinImageEstimation> SpinImageEstimationPtr;
Reply | Threaded
Open this post in threaded view
|

Re: Problem accessing setInputNormals() function in SpinImageEstimation

Maxime Latulippe
It makes sense, but maybe it should be more intuitive if it worked the same manner with the default Ptr. Thank you for your help!
Reply | Threaded
Open this post in threaded view
|

Re: Problem accessing setInputNormals() function in SpinImageEstimation

Radu B Rusu
Administrator
If you guys have a patch, I'd be happy to integrate it in 1.6. ;)

Cheers,
Radu.

On 06/12/2012 04:31 PM, Maxime Latulippe wrote:
> It makes sense, but maybe it should be more intuitive if it worked the same
> manner with the default Ptr. Thank you for your help!
>
> --
> View this message in context: http://www.pcl-users.org/Problem-accessing-setInputNormals-function-in-SpinImageEstimation-tp4019238p4019272.html
> Sent from the Point Cloud Library (PCL) Users mailing list archive at Nabble.com.
> _______________________________________________
> [hidden email] / http://pointclouds.org
> http://pointclouds.org/mailman/listinfo/pcl-users
_______________________________________________
[hidden email] / http://pointclouds.org
http://pointclouds.org/mailman/listinfo/pcl-users
Reply | Threaded
Open this post in threaded view
|

Re: Problem accessing setInputNormals() function in SpinImageEstimation

Maxime Latulippe
Radu,

I confirm what Allan says: Ptr is a typedef for a boost::shared_ptr defined in the three base classes Feature, FeatureFromNormals and FeatureFromLabels. To use the Ptr with the derived classes, such as SpinImageEstimation and ShapeContext3DEstimation, and access their respective functions, the only way I can see would be to redefine Ptr in each. For exemple:

In spin_image.h:
typedef boost::shared_ptr< SpinImageEstimation< PointInT, PointNT, PointOutT > > Ptr;
typedef boost::shared_ptr< const SpinImageEstimation< PointInT, PointNT, PointOutT > > ConstPtr;

In 3dsc:
typedef boost::shared_ptr< ShapeContext3DEstimation< PointInT, PointNT, PointOutT > > Ptr;
typedef boost::shared_ptr< const ShapeContext3DEstimation< PointInT, PointNT, PointOutT > > ConstPtr;

Not sure if there is a better way...

Maxime
Reply | Threaded
Open this post in threaded view
|

Re: Problem accessing setInputNormals() function in SpinImageEstimation

Radu B Rusu
Administrator
Maxime,

That's not a bad plan. Can you please submit a patch via our issue tracker (http://dev.pointclouds.org) and I'll make
sure it gets integrated in the next release? Thanks!

Cheers,
Radu.

On 06/13/2012 06:18 AM, Maxime Latulippe wrote:

> Radu,
>
> I confirm what Allan says: Ptr is a typedef for a boost::shared_ptr defined
> in the three base classes Feature, FeatureFromNormals and FeatureFromLabels.
> To use the Ptr with the derived classes, such as SpinImageEstimation and
> ShapeContext3DEstimation, and access their respective functions, the only
> way I can see would be to redefine Ptr in each. For exemple:
>
> *In spin_image.h:*
> typedef boost::shared_ptr<  SpinImageEstimation<  PointInT, PointNT, PointOutT
>>> Ptr;
> typedef boost::shared_ptr<  const SpinImageEstimation<  PointInT, PointNT,
> PointOutT>  >  ConstPtr;
>
> *In 3dsc:*
> typedef boost::shared_ptr<  ShapeContext3DEstimation<  PointInT, PointNT,
> PointOutT>  >  Ptr;
> typedef boost::shared_ptr<  const ShapeContext3DEstimation<  PointInT,
> PointNT, PointOutT>  >  ConstPtr;
>
> Not sure if there is a better way...
>
> Maxime
>
> --
> View this message in context: http://www.pcl-users.org/Problem-accessing-setInputNormals-function-in-SpinImageEstimation-tp4019238p4019279.html
> Sent from the Point Cloud Library (PCL) Users mailing list archive at Nabble.com.
> _______________________________________________
> [hidden email] / http://pointclouds.org
> http://pointclouds.org/mailman/listinfo/pcl-users
_______________________________________________
[hidden email] / http://pointclouds.org
http://pointclouds.org/mailman/listinfo/pcl-users
Reply | Threaded
Open this post in threaded view
|

Re: Problem accessing setInputNormals() function in SpinImageEstimation

Maxime Latulippe
I will try to do this as soon as possible. I still have a question though: should we correct the problem only for the two classes mentioned here? I guess the same thing happens with a few other classes derived from Feature, FeatureFromNormals and FeatureFromLabels. So, should we systematically add a definition of pointer in each?

Maxime

Radu B. Rusu-2 wrote
Maxime,

That's not a bad plan. Can you please submit a patch via our issue tracker (http://dev.pointclouds.org) and I'll make
sure it gets integrated in the next release? Thanks!

Cheers,
Radu.
Reply | Threaded
Open this post in threaded view
|

Re: Problem accessing setInputNormals() function in SpinImageEstimation

Radu B Rusu
Administrator
I'm fine with adding to each but then we should include some unit tests in the patch to make sure that what we've done
works.

Cheers,
Radu.

On 06/13/2012 06:42 PM, Maxime Latulippe wrote:

> I will try to do this as soon as possible. I still have a question though:
> should we correct the problem only for the two classes mentioned here? I
> guess the same thing happens with a few other classes derived from Feature,
> FeatureFromNormals and FeatureFromLabels. So, should we systematically add a
> definition of pointer in each?
>
> Maxime
>
>
> Radu B. Rusu-2 wrote
>>
>> Maxime,
>>
>> That's not a bad plan. Can you please submit a patch via our issue tracker
>> (http://dev.pointclouds.org) and I'll make
>> sure it gets integrated in the next release? Thanks!
>>
>> Cheers,
>> Radu.
>>
>
>
> --
> View this message in context: http://www.pcl-users.org/Problem-accessing-setInputNormals-function-in-SpinImageEstimation-tp4019238p4019313.html
> Sent from the Point Cloud Library (PCL) Users mailing list archive at Nabble.com.
> _______________________________________________
> [hidden email] / http://pointclouds.org
> http://pointclouds.org/mailman/listinfo/pcl-users
_______________________________________________
[hidden email] / http://pointclouds.org
http://pointclouds.org/mailman/listinfo/pcl-users
Reply | Threaded
Open this post in threaded view
|

Re: Problem accessing setInputNormals() function in SpinImageEstimation

Maxime Latulippe
I made local changes for SpinImageEstimation and ShapeContext3DEstimation. I tested it and it works well. I created the patch for these two classes plus the unit tests file. I am just waiting for my account to be activated so I can submit it.

I will wait for your confirmation before making the change in all other classes. Since it's the first time I create a patch, I want to be sure I did it correctly before.

Maxime

Radu B. Rusu-2 wrote
I'm fine with adding to each but then we should include some unit tests in the patch to make sure that what we've done
works.

Cheers,
Radu.