-
-
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
OUR-CVFH seg-faults when applied to certain PCLPointCloud2 conversions from certain clouds #1449
Comments
It would indeed be good if you could provide a PCD in which your example segfaults. It would be even best it you could replicate the problem with one of the files in this folder. |
Hi Sergio, Here are two sample PCD files from my data set showing segmented partial views of both a box-shaped object and a ball-shaped object. The code I included above, in its original form, causes a seg-fault for the first case, but not for the latter case. I will try testing some of the PCD files you linked to and get back to you. I will also try to test this on a different computer. Cheers, |
Testing on test files from the test folderOk, so I tested the above code on many of the PCD files in the folder you linked to @SergioRAgostinho (at least the ones that seemed like reasonable candidates for testing with OUR-CVFH, i.e. well-segmented objects), and got the following results:
What's interesting here is that it throws a memory error for milk_color.pcd (which is XYZRGBA), but not for milk.pcd (which is XYZ). It's as though the conversion performed using fromPCLPointCloud2() is causing OUR-CVFH to fail, unless the PCLPointCloud2 was read from a file with a point type that matches the target point type for the conversion. I.e., it's ok to go from XYZ PCD file -> PCLPointCloud2 cloud -> XYZ cloud, or XYZRGBA PCD file -> PCLPointCloud2 -> XYZRGBA cloud, but it's not ok to go from XYZRGBA PCD file -> PCLPointCloud2 cloud -> XYZ cloud. Am I using fromPCLPointCloud2() as intended here? The documentation appears to suggest that I am:
Testing on a different computerI have tested the above out on a separate computer (Lenovo Thinkpad Core i7, Ubuntu 14.04, cmake 2.8.12.2, g++ 4.8.4, pcl-trunk) and produced the same results: The box-shaped object causes a seg-fault, whereas the ball-shaped object does not. milk_color.pcd produces the same error as before, whereas milk.pcd succeeds. (I didn't test the remaining PCD files in the test folder as they seem less relevant) |
Thank you for your analysis @barryridge.
At first glance, I don't see any problem with what you're doing. As a side note have you tried load straight into a pointcloud instead of going through PCLPointCloud2, using this |
Yes, I have tried that- in fact, if you'll note, I included that in comments in the code I originally posted. That method works fine. The problem, as I see it, is that it defeats the purpose of using PCLPointCloud2 in the first place- i.e. you might not know what kind of file you're dealing with in advance, but maybe you just want the XYZ points anyway, so you blindly load the file into a PCLPointCloud2 and then convert it to an XYZ cloud. |
@SergioRAgostinho, I thought a little bit more about what you suggested and since I wasn't fully sure if you meant this or not, I decided to try using the pcl::io::loadPCDFile method, templated with PointXYZ, to attempt to load the XYZ component directly from XYZRGBA files like so:
I wasn't expecting this to work, and indeed, it does not. It produces the same results as before with the same files. |
@barryridge You tripped on something. I tried the both milk files you mentioned and the ones you uploaded, and was only able to get a seg-fault out of barcaffebox_seg.pcd. The issue is being caused by an out of bound access here. The |
The problem is being caused by an inconsistency in the way With the particular combination you found, this is a problem because in the pointcloud passed that is passed to pcl::getMaxDistance, the 4th element in your xyz/data[4] is just trash, which is resulting on a wrong calculation of max_pt. I'll submit a PR later today. |
Fixes PointCloudLibrary#1449. getMaxDistance was using the norm of a Eigen::Vector4f to compute the 3D distance between points. The norm was using the 4th element of xyz/data[4] which is often just bit trash. When an index vector is provided, the function was returning the wrong point. Added tests for both
@barryridge The PR was merged. Can you test it to see if it fixed your problem? The error messages you posted before were slightly different than mine. |
@SergioRAgostinho That appears to have resolved the issue on my side for the test files mentioned above. I will do some further testing with a larger data set and let you know if there any further issues. Thanks for your help! |
Hi all,
Firstly, FYI, I am running Ubuntu 14.04, cmake 2.8.12.2, g++ 4.8.4, and pcl-trunk on a Core i7.
I have been having trouble applying OUR-CVFH to a data set of segmented objects in PCD files. It was throwing segmentation faults on numerous files that other feature descriptors, e.g. CVFH, were having no trouble with. After some investigation, I believe I have narrowed things down. I have constructed a minimal example below to demonstrate the issue:
So, assuming others can replicate this with their own data, as you can see from the above code, there is a workaround, but it unfortunately involves jettisoning PCLPointCloud2, which could be a problem if you don't know in advance what kind of PCD files you're working with.
I would be interested to hear if others can replicate this problem. Either way, I can provide sample PCD files showing breakage and non-breakage cases if needed. I have been using partial views of household objects recorded from a Kinect 2 sensor.
Cheers,
Barry Ridge
The text was updated successfully, but these errors were encountered: