Skip to main content

Hi,

 

Basically, I have two point clouds that overlap. One with colour, and one without. I want to find the nearest point with colour to every point without it so that I can use the colour from the nearest point

 

I can do it by:

  • Coercing the subset of points without colour into individual points
  • Mapping the XYZ of the coerced points to an attribute
  • Making a small buffer around these points (say 2.5cm/1 Inch)
  • Then clipping the remaining cloud to a small area around each buffer (creating a large number of small point clouds that have the XYZ of each original point without colour)
  • Turning the coerced XYZ attribute values into a component of the small coloured point clouds
  • Finding the smallest distance of each point cloud between the coerced XYZ component and the coloured XYZ component
  • Using that smallest distance to find one point in each cloud
  • Replacing the XYZ of the nearest neighbour with the coerced component and thereby finding the closest RGB value for the original points that had no colour.
  • Then merging all the point clouds (with one point) back together and with the original part of the cloud that had colour

 

Doing this is very slow and takes up a lot of memory. The coercing and the clipping being the culprits. The point clouds I would be doing this on contain billions of points and don’t have geometries where I can overlay aerial images to get the colour

 

Does anyone know of a better way to do this? I’m sure there is some way in python, but I don’t know how to script python. The main problem I have I guess is I want to get XYZ values for one cloud to another without having to duplicate it billions of times to compensate for all the possible

distances.

 

Thanks

Hello @james_c_452​, I poked some point cloud experts for insight on this. I’ll pass along the information as best I can, but feel free ask for further clarification if needed.

 

There are 2 main approaches to recommend. One is a binning method and the other, a raster method. These approaches also depend on the data involved, if at least one of the layers is plan view oriented (2.5D or less) these approaches should work.

 

  1. The binning approach uses coordinate rounding to a desired resolution – you could round to the nearest metre with a PointCloudExpressionEvaluator. If you round your points to nearest metre, then you can look at the result and extract the min, max, mean or mode and use that to transfer to a component on an overlapping point cloud using PointCloudMerger
  2. Another related approach would be to cast the colored point cloud into raster (ImageRasterizer) and then use PointCloudOnRasterComponentSetter to transfer RBG values onto the target point cloud.

 

Between the two, I think the second method may be easier to adopt and implement. In regards to feedback on your current workspace, there wasn’t much, apologies. Are you using the new 2022.0 Clipper? I know its undergone many improvements since 2021, including performance.

 

Furthermore, if you would like to see something for this use case added to FME in the future, I recommend creating an idea to consider this kind of point cloud processing support. Happy to help, Kailin


Hi @kailinatsafe​ ,

thanks for the answer. I won't be able to use option two because my point cloud is not planar. It covers a variety of aspects, not just one plane. I never even considered this when I was asking because of this reason. It is a helpful tool for other applications though!

I will have a go at option 1 at some stage though. It is an approach I haven't tried and sounds promising

I'm not using the 2022 clipper unfortunately. I'm constrained by using an older version at the moment. I would like to though.

James

 


Hi @kailinatsafe​ I do have one question about this process if you can help out.

I have done as you said for option 1. I rounded the coordinates of point cloud then filtered what has and hasn't got colour (or its colour is black). Then I used 3 PointCloudSplitters to get a single feature/point cloud for each XYZ combination. I then got the median of each of these, made this a component, merged using the PointCloudMerger, restored the coordinates, replaced the colour component, and merged all the pointclouds into one file.

It works but I'm not sure if using a PointCloudSplitter is the most efficient way to get the median colour of each XYZ combination. I've only tried it with feature caching on but it did take a while, because it has to write all the new point clouds. There are thousands for my small test site. Is there a way to find all the medians more easily? Say with the PointCloudExpressionEvaluator or something? Basically a for loop where for each XYZ combination find the median colour red, for example.

Or would this actually run fast if I did it without caching on (I can't test this for a few months)?

Thanks


Hi @kailinatsafe​ I do have one question about this process if you can help out.

I have done as you said for option 1. I rounded the coordinates of point cloud then filtered what has and hasn't got colour (or its colour is black). Then I used 3 PointCloudSplitters to get a single feature/point cloud for each XYZ combination. I then got the median of each of these, made this a component, merged using the PointCloudMerger, restored the coordinates, replaced the colour component, and merged all the pointclouds into one file.

It works but I'm not sure if using a PointCloudSplitter is the most efficient way to get the median colour of each XYZ combination. I've only tried it with feature caching on but it did take a while, because it has to write all the new point clouds. There are thousands for my small test site. Is there a way to find all the medians more easily? Say with the PointCloudExpressionEvaluator or something? Basically a for loop where for each XYZ combination find the median colour red, for example.

Or would this actually run fast if I did it without caching on (I can't test this for a few months)?

Thanks

Hello @james_c_452​, so glad this approach worked for you, thanks for the update! Feature caching is not your friend when processing raster or point clouds, although it is helpful. Yes, I suspect caching could take a big hit on performance, especially if you're working with large data volumes. Please let us know if disabling caching improves processing time!

 

Perhaps try adding a Clipper or a PointCloudSimplifier to reduce the number of points before trying to do calculations? This might impact the accuracy of your results however. I feel like it could be possible to use the PointCloudExpressionEvaluator, but I wouldn't know of any examples for you to reference unfortunately. Let me know if you have any other questions I can try to lend a hand with! Happy to help, Kailin.


Reply