|
Hi List,
I've done some searching for this but not found anything, which could mean user error somewhere... I have used the 1.0.0 release and trunk code (r1277). When I try the "Extracting indices from a PointCloud tutorial (copied first from the site, then tried doc/tutorials/content/sources/extract_indices), it crashes in the while loop at
extract.filter (*cloud_filtered); with a "vector subscript out of range" error. I think this is because the extract instance's input_ cloud is also the output, so when the applyFilter() function resizes the output for the copying, it resizes the internal input as well, and then tries to access indices from the input which are now out of range. I was able to work-around this by filtering to a temporary cloud, then copying it back to cloud_filtered.
Thank you for all the great docs and tutorials - it has been very easy to get started with this library :) Kasia _______________________________________________ [hidden email] / http://pointclouds.org https://code.ros.org/mailman/listinfo/pcl-users |
|
Hi Kasia,
can you perhaps provide us with a bit more info? Which OS are you using, 32 or 64 bit version? I just tried the source code provided on the tutorial page (which is exactly the same as in doc/tutorials/content/sources/extract_indices.cpp) and was able to run it without any problems on Ubuntu 10.10, 64bit, r1281. However looking at the code of extract_indices.hpp I agree with your explanation of the error. Can someone else confirm reproduce this error? Cheers, Sven On Wed, 15 Jun 2011 04:01:14 +1200, Kasia Robnett <[hidden email]> wrote: > Hi List, > > I've done some searching for this but not found anything, which could > mean > user error somewhere... I have used the 1.0.0 release and trunk code > (r1277). > > When I try the "Extracting indices from a PointCloud tutorial (copied > first > from the site, then tried > doc/tutorials/content/sources/extract_indices), it > crashes in the while loop at > > extract.filter (*cloud_filtered); > > with a "vector subscript out of range" error. I think this is because > the > extract instance's input_ cloud is also the output, so when the > applyFilter() function resizes the output for the copying, it resizes the > internal input as well, and then tries to access indices from the input > which are now out of range. I was able to work-around this by filtering > to > a temporary cloud, then copying it back to cloud_filtered. > > Thank you for all the great docs and tutorials - it has been very easy to > get started with this library :) > > Kasia -- Using Opera's revolutionary e-mail client: http://www.opera.com/mail/ _______________________________________________ [hidden email] / http://pointclouds.org https://code.ros.org/mailman/listinfo/pcl-users |
|
In reply to this post by Kasia Robnett
Hi Sven, I am using Windows XP, 32-bit, compiled using Visual Studio Express C++ 2008. I am inexperienced with Windows, so please let me know if there is any other pertinent info.
Best Regards, Kasia Hi Kasia, _______________________________________________ [hidden email] / http://pointclouds.org https://code.ros.org/mailman/listinfo/pcl-users |
|
In reply to this post by Kasia Robnett
Hello,
I am confronting the same problem with Kasia's Does anyone have a solution for this? Thanks, Harry |
|
On Tue, Feb 14, 2012 at 1:14 PM, harry52 <[hidden email]> wrote: Hello, Hi, It was already fixed in trunk (and online) : http://dev.pointclouds.org/projects/pcl/repository/diff/trunk/doc/tutorials/content/sources/extract_indices?rev=4271&rev_to=2776
The up-to-date cpp file is here : http://svn.pointclouds.org/pcl/branches/pcl-1.x/doc/tutorials/content/sources/extract_indices/
It will go into the 1.5.0 release. Cheers, Mourad _______________________________________________ [hidden email] / http://pointclouds.org http://pointclouds.org/mailman/listinfo/pcl-users |
|
I have replaced file "extract_indices.cpp" downloaded from http://svn.pointclouds.org/pcl/branches/pcl-1.x/doc/tutorials/content/sources/extract_indices/ to the older one.
And, my code was already: ... pcl::PointCloud<pcl::PointXYZ>::Ptr cloud_filtered (new pcl::PointCloud<pcl::PointXYZ>), cloud_p (new pcl::PointCloud<pcl::PointXYZ>), cloud_f (new pcl::PointCloud<pcl::PointXYZ>); ... extract.filter (*cloud_f); cloud_filtered = cloud_f; But the exception is the same before. Did I do something wrong? Regards, Harry |
|
In reply to this post by Mourad
I found a same problem when I was trying to create a new point cloud (inliersCloud) to store inliers after applied "Plane model segmentation".
pcl::PointCloud<pcl::PointXYZ>::Ptr inliersCloud (new pcl::PointCloud<pcl::PointXYZ>); Then I initialized like this: inliersCloud->width = inliers->indices.size (); inliersCloud->height = 1; inliersCloud->is_dense = false; inliersCloud->points.resize(inliersCloud->width * inliersCloud->height); And the exception disapears. I think my previous problem can solve by this way too, I am checking on it. ---------------------- By the way, I am confusing that: there are 2 ways to define a point cloud, for example: The first method: pcl::PointCloud<pcl::PointXYZ>::Ptr cloud (new pcl::PointCloud<pcl::PointXYZ>); Or The second method: pcl::PointCloud<pcl::PointXYZ> cloud; To display this cloud by ShowCloud, is it possible to display only the second definition method? pcl::PointCloud<pcl::PointXYZRGB>::Ptr cloud; //... populate cloud pcl::visualization::CloudViewer viewer ("Simple Cloud Viewer"); viewer.showCloud (cloud); while (!viewer.wasStopped ()) { } Regards, Harry |
|
Harry,
On Tue, Feb 14, 2012 at 4:25 PM, harry52 <[hidden email]> wrote: I found a same problem when I was trying to create a new point cloud You're right, the problem wasn't fixed. Now it's fixed in trunk r4468 ( http://dev.pointclouds.org/projects/pcl/repository/diff/trunk/doc?rev=4468&rev_to=4460 ).
---------------------- Here you're declaring a (boost shared) pointer to a pcl::PointCloud<pcl::PointXYZ> object.
Here, you're declaring a pcl::PointCloud<pcl::PointXYZ> object. To display this cloud by ShowCloud, is it possible to display only the pcl::visualization::CloudViewer::showCloud needs a shared pointer to a Pointcloud object, so you'll need a pcl::PointCloud<pcl::PointXYZRGB>::Ptr pointer. It's preferable to initialize the pointer upon declaration .
pcl::PointCloud<pcl::PointXYZRGB>::Ptr cloud (new pcl::PointCloud<pcl::PointXYZRGB>); It's possible to draw a shared pointer from an object, but this will create a new object and trigger a deep copy of your PointCloud object.
pcl::PointCloud<pcl::PointXYZRGB> cloud; pcl::PointCloud<pcl::PointXYZRGB>::Ptr p_cloud = cloud.makeShared (); So, it's more convenient to always use a shared ptr.
Cheers, Mourad Cheers, Mourad _______________________________________________ [hidden email] / http://pointclouds.org http://pointclouds.org/mailman/listinfo/pcl-users |
|
Now it works fine, thanks Mourad :)
Regards, Harry |
|
harry52 wrote > > Now it works fine, thanks Mourad :) > > Regards, > Harry > Hi Harry, I am still stuck on this error where I'm crashing at: extract.filter (*cloud_plane); std::cout << "PointCloud representing the planar component: " << cloud_plane->points.size () << " data points." << std::endl; cloud_f->width = inliers->indices.size (); cloud_f->height = 1; cloud_f->is_dense = false; cloud_f->points.resize(cloud_f->width * cloud_f->height); // Remove the planar inliers, extract the rest extract.setNegative (true); extract.filter (*cloud_f); cloud_filtered = cloud_f; Would you be able to help me find out why I'm not working? Thanks! JL -- View this message in context: http://www.pcl-users.org/extracting-indices-tutorial-vector-subscript-error-tp3063598p3887915.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 |
|
after I tried this:
extract.filter (*cloud_f); *cloud_filtered = *cloud_f; it worked fine |
|
In reply to this post by JLSS
Hi JLSS,
I just came back from my vacation. Sorry, now I could be able to reply to you. Have you already solved your problem? If not, could you please try replacing this: cloud_filtered = cloud_f; by cloud_filtered.swap (cloud_f); and see whether it works. Greetings, Harry |
| Powered by Nabble | Edit this page |
