0
$\begingroup$

With the increased popularity of 3D imaging and scanning I thought it would be easy to transform a xyz point cloud into a Height Map (xy matrix of z points), but after a couple of hours searching I found nothing. Maybe I'm looking in the wrong direction, isn't there some C++ library for this type of conversion?

$\endgroup$
4
  • 1
    $\begingroup$ Welcome to scicomp! Could you give us a bit more information? In what format is your point cloud saved? Are they rastered in some form? What is the datatype you expect as output? $\endgroup$ – MPIchael Jan 28 at 11:14
  • $\begingroup$ Thank you :-) The point cloud is generated and corrected for lens deformation so the points are no longer aligned in a grid, I get a vector of x, y, z points. The data type is double. I want to transform it into a matrix of xy size so that I can save it into an image like a height map. $\endgroup$ – Pedro Ferreira Jan 28 at 11:34
  • 1
    $\begingroup$ I think your best bet is matlab, see (de.mathworks.com/matlabcentral/answers/…) or (de.mathworks.com/help/vision/…) $\endgroup$ – MPIchael Jan 28 at 12:06
  • 1
    $\begingroup$ depending on the precision and rigorosity requirements, you may also get away with using functionalities of gnuplot or matplotlib to plot heatmaps. If I remember correctly both have the functionality to take non-grid data as input. see e.g. (stackoverflow.com/questions/2369492/…) $\endgroup$ – MPIchael Jan 28 at 12:10
1
$\begingroup$

Think of this as a point cloud over a chess board. Then, for each of the squares of the board, find all the points that lie over that square (i.e., whose $x,y$ values are within that square) and take the maximal $z$ value to generate the height over that square.

Of course, you're not bound to an $8\times 8$ board, but can choose the number of squares. You want to choose it in such a way that you have a sufficient number of points over each of the squares so that you get a reasonable approximation of the actual height, without "empty" squares.

$\endgroup$
8
  • $\begingroup$ Its a possible solution, but I lose too much detail, I have 2000 by 2000 points and I want to keep the same number of points (resolution). $\endgroup$ – Pedro Ferreira Jan 28 at 16:04
  • $\begingroup$ So I'm looking for some kind of interpolation of values. $\endgroup$ – Pedro Ferreira Jan 28 at 16:10
  • $\begingroup$ Is your point cloud convex? In that case you could compute the convex hull. But if it's not convex, it's difficult to define exactly what the "upper surface" is unless you have a way to label which of the points are on the surface and which are in the interior. $\endgroup$ – Wolfgang Bangerth Jan 28 at 21:45
  • $\begingroup$ The point cloud is not necessarily convex $\endgroup$ – Pedro Ferreira Jan 29 at 10:45
  • $\begingroup$ So then how do you know what is an interior point and what is a point on the upper surface? $\endgroup$ – Wolfgang Bangerth Jan 29 at 20:38

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.