Forum

Author Topic: Large coordinates truncated in PLY  (Read 9516 times)

macsurveyr

  • Jr. Member
  • **
  • Posts: 65
    • View Profile
Large coordinates truncated in PLY
« on: March 13, 2013, 02:41:46 AM »
Many projected coordinate systems have coordinates that exceed 1,000,000

PLY files are exported with the coordinates as property float which means that the coordinates are truncated.

Perhaps with most data sets that goes unnoticed, but a building placed in UTM coordinates that exceed 500,000,4,000,000 it is pretty obvious.

If any coordinate exceeds 1,000,000 it should be stored as property double.

Tom

Alexey Pasumansky

  • Agisoft Technical Support
  • Hero Member
  • *****
  • Posts: 13908
    • View Profile
Re: Large coordinates truncated in PLY
« Reply #1 on: March 13, 2013, 07:00:08 PM »
Hello Tom,

If you save PLY in text format you can see that the precision is kept for big numbers, so the problem may be caused by the viewer software that could not handle big numbers.
As an alternative you can use Shift values in the export dialog to subtract large numbers before importing the model to the mesh editors.

Best regards,
Alexey Pasumansky,
Agisoft LLC

macsurveyr

  • Jr. Member
  • **
  • Posts: 65
    • View Profile
Re: Large coordinates truncated in PLY
« Reply #2 on: March 15, 2013, 03:55:08 AM »
Hello Alexey,

Yes, I see that if I save the PLY in ascii format the precision is kept and displays fine in several viewers if the coordinates are offset at import time by 0,4390000.0

I saved the same file again in binary and it does not display properly even with an offset at import time.

So declaring float is not the issue and either the coordinates are not being stored at double precision in the binary PLY or different viewing softwares that allow offset at viewing time are not reading the binary PLY file properly.

Here are links to both files I created.

https://www.dropbox.com/s/vv21m6wxq1pnio2/FMHP_RU_sparse_ascii.ply

https://www.dropbox.com/s/dhqtb1vhtrgbv8r/FMHP_RU_sparse_binary.ply

Tom

jedfrechette

  • Full Member
  • ***
  • Posts: 117
  • Lidar Guys
    • View Profile
    • www.lidarguys.com
Re: Large coordinates truncated in PLY
« Reply #3 on: March 15, 2013, 08:16:15 PM »
According to this page:

http://paulbourke.net/dataformats/ply/

which I believe is the official definition of the format, data properties need to be defined as "double" not "float" if you want double precision instead of single precision floating point values.  In both of the example files the x, y, and z coordinates are defined as "float", hence the rounding errors when trying to use the binary version. The fact that the ascii version works  seems to be an accident due to PhotoScan writing out more significant digits than it declares in the header.
Jed

macsurveyr

  • Jr. Member
  • **
  • Posts: 65
    • View Profile
Re: Large coordinates truncated in PLY
« Reply #4 on: March 18, 2013, 12:24:07 AM »
jedfrechette

I believe you are exactly correct. It is probably an accident that the ascii version works in some viewers. And it comes back to declaring float is the problem, even if the data is stored at double precision.

Tom

daveg

  • Newbie
  • *
  • Posts: 4
    • View Profile
Re: Large coordinates truncated in PLY
« Reply #5 on: June 04, 2015, 06:07:55 PM »
I know this is an old thread, but I've been struggling with this issue lately. My workflow involves making fine co-registration between models in Cloud Compare, so exporting in real-world coordinates is best. It would save me a bunch of time and potential for errors to be able to export direct to .ply in UTM, with no shift required. Point clouds work great, of course, both on export and import. And, Cloud Compare can handle the big coordinates, and even proposes the global shift. (Even this would be a very useful feature in Photoscan!)

Is there any thought to work on this issue in coming versions?

Alexey Pasumansky

  • Agisoft Technical Support
  • Hero Member
  • *****
  • Posts: 13908
    • View Profile
Re: Large coordinates truncated in PLY
« Reply #6 on: June 04, 2015, 07:21:49 PM »
Hello daveg,

Do you have issues with UTM coordinates for the PLY clouds in Cloud Compare?

If you save PLY in text (not binary) format, I think that you should see the correct coordinate info for the points and it shouldn't be truncated on export.
Best regards,
Alexey Pasumansky,
Agisoft LLC

daveg

  • Newbie
  • *
  • Posts: 4
    • View Profile
Re: Large coordinates truncated in PLY
« Reply #7 on: June 08, 2015, 05:08:20 PM »
Hi Alexey
Thanks for your reply. I have tried the text PLY export, and it works well. But, my models are often in the 50-75 million face range, in which case the text PLY is a huge file and takes a really long time to write. For now the best workaround has been to export points as .las in UTM, and model in .ply local coords, then align these in Cloud Compare to get the model in the UTM coordinates for comparing to other data. For some reason I've had less success using the transformation at export, although this is probably just errors on my part. Its also a bit less convenient in Cloud Compare,
Cheers
Dave