1

I was wondering if it was possible for someone to provide me with some code examples for working with scattered XYZ point data in Point cloud Library? I would like to fit a cylindrical model to segmented scattered point cloud. In short, something like this (https://in.mathworks.com/help/vision/ref/pcfitcylinder.html):

enter image description here

Zoe
  • 27,060
  • 21
  • 118
  • 148
  • Just an update on what I did, I used http://pointclouds.org/documentation/tutorials/cylinder_segmentation.php as suggested by @brad and got the cylindrical configuration. Will use it to get quaternion and get the translation wrt origin. Thank you everyone! – adityagabbar Feb 19 '17 at 09:34

2 Answers2

1

http://pointclouds.org/documentation/tutorials/cylinder_segmentation.php

Just take out the plane fitting stuff

brad
  • 930
  • 9
  • 22
  • Thanks for that Brad, but what I am trying to do is fit a model to the [already] segmented cylindrical like point cloud. I have edited my question to make it more clear. – adityagabbar Feb 14 '17 at 08:06
  • 1
    despite the fact that you have already segmented the cylinder, as far as I am aware you can still run this segmentation, and it will generate a cylinder seg model which you can compute the coefficients from as shown here: http://docs.pointclouds.org/trunk/classpcl_1_1_sample_consensus_model_cylinder.html -"computeModelCoefficients" -"optimizeModelCoefficients", – Sneaky Polar Bear Feb 14 '17 at 16:29
  • 1
    @SneakyPolarBear I think "computeModelCoefficients" will do the work for me. Thanks for your help. I'll update as soon as I finish it. – adityagabbar Feb 14 '17 at 19:16
  • Link in the answer is not working anymore, here is the new link: https://pointclouds.org/documentation/tutorials/cylinder_segmentation.html#cylinder-segmentation – belitd Jul 15 '21 at 17:18
0

If you have a segmented scene of a cylinder and you have a model cylinder... icp has no local minimums and will get you your pose (note that it will have rotational and translational symetry in the pose (ie there will be a set of solutions of which you will get one)

Here is the icp tutorial: http://pointclouds.org/documentation/tutorials/iterative_closest_point.php

Sneaky Polar Bear
  • 1,611
  • 2
  • 17
  • 29
  • Thanks again., but as I don't have a prior model of the object, (I think this might work) to compute an approximate model in first step (using"computeModelCoefficients"), save it & then use it as match in later sequence ? – adityagabbar Feb 14 '17 at 19:20
  • For ICP you are going to want a similar point cloud. This could be very easy to generate if you wanted, ie generate circles of points at various heights along the z axis. You would need to know your cylinder radius to generate this model though. The model coefficients would tell you everything you would need to know to make this model... though it would be redundant to use both methods, they both would give you a similar result with a different "style", ie model coefficients vs a 4d transformation matrix – Sneaky Polar Bear Feb 14 '17 at 19:48