Question

I am trying to enlarge a point cloud data set. Suppose I have a point cloud data set consisting of 100 points & I want to enlarge it to say 5 times. Actually I am studying some specific structure which is very small, so I want to zoom in & do some computations. I want something like imresize() in Matlab. Is there any function to do this? What does resize() function do in PCL? Any idea about how can I do it?

Was it helpful?

Solution 2

Since you want to increase the number of points while preserving shape/structure of the cloud, I think you want to do something like 'upsampling'.

Here is another SO question on this.

The PCL offers a class for bilateral upsampling.

And as always google gives you a lot of hints on this topic.

OTHER TIPS

Why would you need this? Points are just numbers, regardless whether they are 1 or 100, until all of them are on the same scale and in the same coordinate system. Their size on the screen is just a visual representation, you can zoom in and out as you wish.

You want them to be a thousandth of their original value (eg. millimeters -> meters change)? Divide them by 1000.

You want them spread out in a 5 times larger space in that particular coordinate system? Multiply their coordinates with 5. But even so, their visual representations will look exactly the same on the screen. The data remains basically the same, they will not be resized per se, they numeric representation will change a bit. It is the simplest affine transform, just a single multiplication.

You want to have finer or coarser resolution of your numeric representation? Or have different range? Change your data type accordingly.

That is, if you deal with a single set.

If you deal with different sets, say, recorded with different kinds of sensors and the numeric representations differ a bit (there are angles between the coordinate systems, mm vs cm scale, etc.) you just have to find the transformation from one coordinate system to the other one and apply it to the first one.

Beside (what Ziker mentioned) increasing allocated memory (that's not what you want, right?) or zooming in in visualization you could just rescale your point cloud.

This can be done by multiplying each points dimensions with a constant factor or using an affine transformation. So you can e.g switch from mm to m.

If i understand your question correctly If you have defined your cloud like this

pcl::PointCloud<pcl::PointXYZ>::Ptr cloud (new pcl::PointCloud<pcl::PointXYZ>);

in fact you can do resize

cloud->points.resize (cloud->width * cloud->height);

Note that doing resize does nothing more than allocate more memory for variable thus after resizing original data remain in cloud. So if you want to have empty resized cloud dont forget to add cloud->clear();

If you just want zoom some pcd for visual puposes(i.e you cant see what is shape of cloud because its too small) why dont you use PCL Visualization and zoom by scrolling up/down

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top