[GRASS-user] Using GRASS on a ply file
Moritz Lennert
mlennert at club.worldonline.be
Wed Jun 6 04:49:23 PDT 2018
Hello Marion and welcome to the GRASS community !
On 06/06/18 12:03, marion-brunet wrote:
> Hello,
>
> I have two point clouds of an open-pit mine taken a few weeks apart. I
> would like to estimate the volume that has been excavated during that
> interval, i.e the difference between the two point clouds. For that I
> used CloudCompare to get a new point cloud corresponding to the distance
> between the first two clouds. Now I need to know the
> Z information of each point of this last cloud. I want to use GRASS to
> do it, but I can't find a method that is working...
>
> The first method I was suggested is to use*v.in.ply* and then*r.report*,
> but I have several issues:
> - When I use *v.in.ply* I have this error: *ERROR: Wrong number of
> properties*. Is it a common error? How can I solve it? I have attached a
> part of my .ply file to this email so you can see how it is formatted.
[Marion sent me an extract of the data offline]
It seems that every data line in your .ply file has a trailing white
space at the end. This is counted as an extra property and explains the
message. When I erase these trailing white spaces, I don't get this
error anymore. I don't know the format enough to know whether this is an
issue with v.in.ply not tolerating these white spaces, or an issue with
the program creating the .ply file which shouldn't add a white space at
the end.
> - After importing my .ply file, I would like to use something like
> *r.report *to get the value of each point. However, I don't know how to
> convert my file into a format that this command will work with... Could
> you help me?
r.report gives you a summary report about a raster, not a value by point.
Generally, if you want to cover an entire zone (your entire open-pit
mine, you will probably want to go the raster way. So, with the points
imported with v.in.ply, you could do something like the following:
g.region vect=points res=1 -ap #set the xy extension of your raster to
the xy extension of the point cloud, and the resolution to 1 (you have
to adjust that depending on the size of your zone)
v.surf.rst in=points out=mined_surface #interpolate a continous height
surface across the entire area
r.volume mined_surface #calculate volume
>
> The second method I read about is *r.in.xyz*, but I don't know how it
> works, or what format of input I should use. Can I have more information
> about it?
r.in.xyz is another option. It takes XYZ data and aggregates it by pixel
using a user-determined aggregation function. If you have a higher point
density than your target resolution, then you could use just the data
part of your .ply file, i.e. the part which has lines such as
[...]
97.08156 121.6752 99.27532 0 0 0 12 9 2 255
97.08911 121.718 99.50104 0 0 0 46 40 24 255
93.25124 115.0372 102.7768 0 0 0 62 53 20 255
97.96031 123.8419 103.3994 0 0 0 150 184 211 255
97.10852 121.6866 99.42679 0 0 0 9 9 0 255
97.11196 121.7049 99.59032 0 0 0 19 12 4 255
97.13282 121.688 99.43796 0 0 0 38 28 16 255
97.17371 121.7129 99.41496 0 0 0 43 31 15 255
97.1614 121.6344 99.27691 0 0 0 9 6 1 255
[...]
Knowing that there are 17 lines of other info at the top of the extract
you sent me, I could import the data using:
r.in.xyz in=BROL/BascFin2-extrait.ply skip=17 out=xyz_mean method=mean
sep=space
However, as the extent of the cloud is very large, but there are only a
few points, most of the pixels in the resulting raster are filled with
NULL values as there are no points falling within these pixels.
Moritz
More information about the grass-user
mailing list