pcl::Poisson not setting correctly the dimensions of the cloud. BUG in poisson.hpp

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

pcl::Poisson not setting correctly the dimensions of the cloud. BUG in poisson.hpp

fez
This post was updated on .
Hi everyone!
I'm using PCL from some months and it's really amazing!

But today I stepped into some strange behaviour. I have a
PointCloud<PointXYZ> and I'm trying to reconstruct the surface using the
poisson algorithm. First I calculate the normals, setting the point of view
to be sure they're looking all in the same direction. Then I feed them into
the poisson surface reconstruction. The reconstruction seems to work fine,
but actually there are two methods to do that:

1) void performReconstruction (pcl::PolygonMesh &output)
2) void performReconstruction (pcl::PointCloud< PointNT > &points,
std::vector< pcl::Vertices > &polygons)

1) works perfectly, and I can also print the mesh to a vtk file.
2) seems to work fine, and fills the cloud properly but the height and
width of the cloud are not set. the std::vector containing the points in
the cloud is full, and it has the same points as the output mesh of method
1).

The problem is that I need to use the output cloud again, so I need method
2). What I cand do? Am I doing something wrong or weird? I tried to look a
little bit into method 2) code and at first sight it seems to resize the
cloud, but actually I have to admit that I don't have much experience in
object oriented programming, so I'm not sure. But if I set manually the
dimensions of the output cloud to points.width() and I try to print it to
pcd I have no problems and the cloud it's the same. Can it be a bug in
method 2) ?

Anyway I attach you my example code. The parameters are set to work with
this cloud:
http://svn.pointclouds.org/data/tutorials/correspondence_grouping/milk.pcd
It just takes an argument: the input pcd file. It prints the results in
./mesh.vtk and ./cloud.pcd.

In the code I'm using first method 1) and then method 2) but I tried also
only with method 2) to avoid interferences and I still have the same
behaviour.

I hope some of you can help me!
Thanks in advance!

Fez

_______________________________________________
PCL-users@pointclouds.org / http://pointclouds.org
http://pointclouds.org/mailman/listinfo/pcl-users


example.cpp (3K) <http://www.pcl-users.org/attachment/4029295/0/example.cpp>
fez
Reply | Threaded
Open this post in threaded view
|

Re: pcl::Poisson not setting correctly the dimensions of the cloud

fez
Actually in the example I attached you have to remove the lines 60 and 61, where I was manually setting the dimensions of the cloud to avoid the described behaviour. If you remove them you should have an error when running the example, when PCDwriter tries to write to a file a cloud with width and height = 0.

Sorry for the mistake!

_______________________________________________
[hidden email] / http://pointclouds.org
http://pointclouds.org/mailman/listinfo/pcl-users
fez
Reply | Threaded
Open this post in threaded view
|

Re: pcl::Poisson not setting correctly the dimensions of the cloud

fez
Ok I found the problem!
It's a bug in poisson.hpp, line 274 (see here http://docs.pointclouds.org/trunk/poisson_8hpp_source.html#l00232 )

points.points.resize (int (mesh.outOfCorePointCount () + mesh.inCorePoints.size ()));

it should be

points.resize (int (mesh.outOfCorePointCount () + mesh.inCorePoints.size ()));

because it's the cloud that should be resized, not the std::vector of points inside it!

What should I do to submit it somewhere?


2013/8/27 Pietro Fez <[hidden email]>
Actually in the example I attached you have to remove the lines 60 and 61, where I was manually setting the dimensions of the cloud to avoid the described behaviour. If you remove them you should have an error when running the example, when PCDwriter tries to write to a file a cloud with width and height = 0.

Sorry for the mistake!


_______________________________________________
[hidden email] / http://pointclouds.org
http://pointclouds.org/mailman/listinfo/pcl-users
Reply | Threaded
Open this post in threaded view
|

Re: pcl::Poisson not setting correctly the dimensions of the cloud

Radu B. Rusu
Administrator
Pietro,

Thanks in advance for your contribution. Please submit it as a pull request via GitHub.

Best,
Radu.

On Aug 27, 2013, at 2:01 PM, Pietro Fez <[hidden email]> wrote:

Ok I found the problem!
It's a bug in poisson.hpp, line 274 (see here http://docs.pointclouds.org/trunk/poisson_8hpp_source.html#l00232 )

points.points.resize (int (mesh.outOfCorePointCount () + mesh.inCorePoints.size ()));

it should be

points.resize (int (mesh.outOfCorePointCount () + mesh.inCorePoints.size ()));

because it's the cloud that should be resized, not the std::vector of points inside it!

What should I do to submit it somewhere?


2013/8/27 Pietro Fez <[hidden email]>
Actually in the example I attached you have to remove the lines 60 and 61, where I was manually setting the dimensions of the cloud to avoid the described behaviour. If you remove them you should have an error when running the example, when PCDwriter tries to write to a file a cloud with width and height = 0.

Sorry for the mistake!

_______________________________________________
[hidden email] / http://pointclouds.org
http://pointclouds.org/mailman/listinfo/pcl-users


_______________________________________________
[hidden email] / http://pointclouds.org
http://pointclouds.org/mailman/listinfo/pcl-users
fez
Reply | Threaded
Open this post in threaded view
|

Re: pcl::Poisson not setting correctly the dimensions of the cloud

fez
Ok I just did it!
I hope everything is ok, because this is my first contribution via github.

Cheers,

fez

_______________________________________________
[hidden email] / http://pointclouds.org
http://pointclouds.org/mailman/listinfo/pcl-users