[pdal] Way to cast dimension data type?

classic Classic list List threaded Threaded
4 messages Options
Reply | Threaded
Open this post in threaded view
|

[pdal] Way to cast dimension data type?

Piero Toffanin

Hello,

First let me say that PDAL rocks. I love it.

I was wondering if there's a way to specify (cast) the data type of the X,Y,Z dimensions while reading a PLY file (so in effect override the type specified in the PLY header) in the PDAL pipeline.

I have an input PLY file (untransformed.ply) that has the header:

ply
format ascii 1.0
[ .... ]
property float x
property float y
property float z
[ .... ]

And coordinate points with ~5 digits of precision.

1.13759 12.1322 162.786
[ .... ]

When I try to apply the following transform (add a east/north offset):

{
  "pipeline": [
    "untransformed.ply",
    {
      "matrix": "1 0 0 576705 0 1 0 5188170 0 0 1 0 0 0 0 1",
      "type": "filters.transformation"
    },
    {
      "a_srs": "EPSG:32615",
      "filename": "transformed.las",
      "offset_x": "576705",
      "offset_y": "5188170",
      "offset_z": "0"
    }
  ]
}

There's a loss of precision (I get a "grid-like" output, see https://cloud.githubusercontent.com/assets/1951843/25507885/9cd01d12-2b7c-11e7-9c54-0e219dae4f05.png). I think it's because the matrix transformation code here https://github.com/PDAL/PDAL/blob/dd97a033c5d487000e200304a7619e9978de6ae2/filters/TransformationFilter.cpp#L106 correctly treats points as floats.

Changing the PLY header to:

ply
format ascii 1.0
[ .... ]
property double x
property double y
property double z
[ .... ]

Produces the expected output (no grid-like output).

I was wondering if I could force the dimensions to be treated as a double directly from PDAL? Or perhaps is there interest in adding a flag (cast to dimension) in PDAL's PLY reader (I'd be happy to contribute to it)?

More information about the background of this issue is also available here: https://github.com/OpenDroneMap/OpenDroneMap/issues/522

Thank you for any information you might have!

-Piero


_______________________________________________
pdal mailing list
[hidden email]
https://lists.osgeo.org/mailman/listinfo/pdal
Reply | Threaded
Open this post in threaded view
|

Re: [pdal] Way to cast dimension data type?

andrew.bell.ia@gmail.com
I opened this ticket:


It should be fixed shortly.

On Sat, May 6, 2017 at 5:36 PM, Piero Toffanin <[hidden email]> wrote:

Hello,

First let me say that PDAL rocks. I love it.

I was wondering if there's a way to specify (cast) the data type of the X,Y,Z dimensions while reading a PLY file (so in effect override the type specified in the PLY header) in the PDAL pipeline.

I have an input PLY file (untransformed.ply) that has the header:

ply
format ascii 1.0
[ .... ]
property float x
property float y
property float z
[ .... ]

And coordinate points with ~5 digits of precision.

1.13759 12.1322 162.786
[ .... ]

When I try to apply the following transform (add a east/north offset):

{
  "pipeline": [
    "untransformed.ply",
    {
      "matrix": "1 0 0 576705 0 1 0 5188170 0 0 1 0 0 0 0 1",
      "type": "filters.transformation"
    },
    {
      "a_srs": "EPSG:32615",
      "filename": "transformed.las",
      "offset_x": "576705",
      "offset_y": "5188170",
      "offset_z": "0"
    }
  ]
}

There's a loss of precision (I get a "grid-like" output, see https://cloud.githubusercontent.com/assets/1951843/25507885/9cd01d12-2b7c-11e7-9c54-0e219dae4f05.png). I think it's because the matrix transformation code here https://github.com/PDAL/PDAL/blob/dd97a033c5d487000e200304a7619e9978de6ae2/filters/TransformationFilter.cpp#L106 correctly treats points as floats.

Changing the PLY header to:

ply
format ascii 1.0
[ .... ]
property double x
property double y
property double z
[ .... ]

Produces the expected output (no grid-like output).

I was wondering if I could force the dimensions to be treated as a double directly from PDAL? Or perhaps is there interest in adding a flag (cast to dimension) in PDAL's PLY reader (I'd be happy to contribute to it)?

More information about the background of this issue is also available here: https://github.com/OpenDroneMap/OpenDroneMap/issues/522

Thank you for any information you might have!

-Piero


_______________________________________________
pdal mailing list
[hidden email]
https://lists.osgeo.org/mailman/listinfo/pdal



--
Andrew Bell
[hidden email]

_______________________________________________
pdal mailing list
[hidden email]
https://lists.osgeo.org/mailman/listinfo/pdal
Reply | Threaded
Open this post in threaded view
|

Re: [pdal] Way to cast dimension data type?

Howard Butler-3
I pushed the tag to trigger the pdal/pdal:latest docker image rebuild if you want to verify using that mechanism. Otherwise, you will have to build master yourself to confirm.

Thanks for the report Piero!

Howard

> On May 8, 2017, at 8:59 AM, Andrew Bell <[hidden email]> wrote:
>
> I opened this ticket:
>
> https://github.com/PDAL/PDAL/issues/1584
>
> It should be fixed shortly.
>
> On Sat, May 6, 2017 at 5:36 PM, Piero Toffanin <[hidden email]> wrote:
> Hello,
>
> First let me say that PDAL rocks. I love it.
> I was wondering if there's a way to specify (cast) the data type of the X,Y,Z dimensions while reading a PLY file (so in effect override the type specified in the PLY header) in the PDAL pipeline.
>
> I have an input PLY file (untransformed.ply) that has the header:
>
> ply
> format ascii 1.0
> [ .... ]
> property float x
> property float y
> property float z
> [ .... ]
>
> And coordinate points with ~5 digits of precision.
>
> 1.13759 12.1322 162.786
> [ .... ]
> When I try to apply the following transform (add a east/north offset):
> {
>   "pipeline": [
>     "untransformed.ply",
>     {
>       "matrix": "1 0 0 576705 0 1 0 5188170 0 0 1 0 0 0 0 1",
>       "type": "filters.transformation"
>     },
>     {
>       "a_srs": "EPSG:32615",
>       "filename": "transformed.las",
>       "offset_x": "576705",
>       "offset_y": "5188170",
>       "offset_z": "0"
>     }
>   ]
> }
> There's a loss of precision (I get a "grid-like" output, see https://cloud.githubusercontent.com/assets/1951843/25507885/9cd01d12-2b7c-11e7-9c54-0e219dae4f05.png). I think it's because the matrix transformation code here https://github.com/PDAL/PDAL/blob/dd97a033c5d487000e200304a7619e9978de6ae2/filters/TransformationFilter.cpp#L106 correctly treats points as floats.
> Changing the PLY header to:
>
> ply
> format ascii 1.0
> [ .... ]
> property double x
> property double y
> property double z
> [ .... ]
>
> Produces the expected output (no grid-like output).
> I was wondering if I could force the dimensions to be treated as a double directly from PDAL? Or perhaps is there interest in adding a flag (cast to dimension) in PDAL's PLY reader (I'd be happy to contribute to it)?
> More information about the background of this issue is also available here: https://github.com/OpenDroneMap/OpenDroneMap/issues/522
>
> Thank you for any information you might have!
>
> -Piero
>
>
> _______________________________________________
> pdal mailing list
> [hidden email]
> https://lists.osgeo.org/mailman/listinfo/pdal
>
>
>
> --
> Andrew Bell
> [hidden email]
> _______________________________________________
> pdal mailing list
> [hidden email]
> https://lists.osgeo.org/mailman/listinfo/pdal

_______________________________________________
pdal mailing list
[hidden email]
https://lists.osgeo.org/mailman/listinfo/pdal
Reply | Threaded
Open this post in threaded view
|

Re: [pdal] Way to cast dimension data type?

Piero Toffanin
Wow, thanks for looking into this so quickly!

-Piero


On 05/08/2017 10:17 AM, Howard Butler wrote:

> I pushed the tag to trigger the pdal/pdal:latest docker image rebuild if you want to verify using that mechanism. Otherwise, you will have to build master yourself to confirm.
>
> Thanks for the report Piero!
>
> Howard
>
>> On May 8, 2017, at 8:59 AM, Andrew Bell <[hidden email]> wrote:
>>
>> I opened this ticket:
>>
>> https://github.com/PDAL/PDAL/issues/1584
>>
>> It should be fixed shortly.
>>
>> On Sat, May 6, 2017 at 5:36 PM, Piero Toffanin <[hidden email]> wrote:
>> Hello,
>>
>> First let me say that PDAL rocks. I love it.
>> I was wondering if there's a way to specify (cast) the data type of the X,Y,Z dimensions while reading a PLY file (so in effect override the type specified in the PLY header) in the PDAL pipeline.
>>
>> I have an input PLY file (untransformed.ply) that has the header:
>>
>> ply
>> format ascii 1.0
>> [ .... ]
>> property float x
>> property float y
>> property float z
>> [ .... ]
>>
>> And coordinate points with ~5 digits of precision.
>>
>> 1.13759 12.1322 162.786
>> [ .... ]
>> When I try to apply the following transform (add a east/north offset):
>> {
>>    "pipeline": [
>>      "untransformed.ply",
>>      {
>>        "matrix": "1 0 0 576705 0 1 0 5188170 0 0 1 0 0 0 0 1",
>>        "type": "filters.transformation"
>>      },
>>      {
>>        "a_srs": "EPSG:32615",
>>        "filename": "transformed.las",
>>        "offset_x": "576705",
>>        "offset_y": "5188170",
>>        "offset_z": "0"
>>      }
>>    ]
>> }
>> There's a loss of precision (I get a "grid-like" output, see https://cloud.githubusercontent.com/assets/1951843/25507885/9cd01d12-2b7c-11e7-9c54-0e219dae4f05.png). I think it's because the matrix transformation code here https://github.com/PDAL/PDAL/blob/dd97a033c5d487000e200304a7619e9978de6ae2/filters/TransformationFilter.cpp#L106 correctly treats points as floats.
>> Changing the PLY header to:
>>
>> ply
>> format ascii 1.0
>> [ .... ]
>> property double x
>> property double y
>> property double z
>> [ .... ]
>>
>> Produces the expected output (no grid-like output).
>> I was wondering if I could force the dimensions to be treated as a double directly from PDAL? Or perhaps is there interest in adding a flag (cast to dimension) in PDAL's PLY reader (I'd be happy to contribute to it)?
>> More information about the background of this issue is also available here: https://github.com/OpenDroneMap/OpenDroneMap/issues/522
>>
>> Thank you for any information you might have!
>>
>> -Piero
>>
>>
>> _______________________________________________
>> pdal mailing list
>> [hidden email]
>> https://lists.osgeo.org/mailman/listinfo/pdal
>>
>>
>>
>> --
>> Andrew Bell
>> [hidden email]
>> _______________________________________________
>> pdal mailing list
>> [hidden email]
>> https://lists.osgeo.org/mailman/listinfo/pdal

_______________________________________________
pdal mailing list
[hidden email]
https://lists.osgeo.org/mailman/listinfo/pdal