davidcaron / pye57

Read and write e57 point clouds from Python
MIT License
70 stars 42 forks source link

Handle missing cartesianInvalidState #6

Closed markummitchell closed 2 years ago

markummitchell commented 5 years ago

Hello, It seems that a file without <cartesianInvalidState> cannot be read. Without that xml tag, the following error appears for any input file

File "..." in read_scan "Consider using 'ignore_missing_fields' to skip it. ValueError: Requested to read a field (cartesianInvalidState) with is absent from the e57 file. Consider using 'ignore_missing_fields' to skip it.

So I retry with

e57 = e57.read_scan(0, ignore_missing_fields = True)

and get

valid = ~data["cartesianInvalidState"].astype("?") KeyError: 'cartesianInvalidState'

In my final attempt I added a <cartesianInvalidState> entry copied from http://www.libe57.org/example.html. That resulted in a file length header in the header:

pye57.libe57.E57Exception: size in file header not same as actual (57_ERROR_BAD_FILE_LENGTH)

I suggest some extra code to handle files missing <cartesianInvalidState>, for compatibility with Adobe ReCap. Thanks

rrdvos commented 4 years ago

You can use .read_scan_raw() instead of .read_scan()

tgaher commented 4 years ago

Hi @markummitchell could you solve this? I got the exact same errors (Python 3.6.9) I tried replacing it with read_scan_raw() @TheRandomGamerMC solution but got "ValueError: Unsupported point field: nor:normalX" error message

Lerri-Cofannos commented 4 years ago

Hello !I have the exact same issue, with the "ValueError: Unsupported point field: nor:normalX" error when I use read.scan.raw, and the "valid = ~data["cartesianInvalidState"].astype("?") KeyError: 'cartesianInvalidState'" error when I use _readscan with the _ignore_missingfields argument. Help would be welcomed !

procton commented 4 years ago

Any progress regarding files without "cartesianInvalidState" ? Thanks

nevilamos commented 3 years ago

Hi I have encountered similar problems. I am trying to read an e57 exported from a Leica BLK360 via the free BLK360 app on ipad. I can open and visualise the point colud in cloudcompare however then I try to read using pye57 I get the following

e57 = e57.read_scan_raw(0) ValueError: Unsupported point field: sphericalRange

e57 = e57.read_scan(0, ignore_missing_fields = True) E57Exception: bad API function argument provided by user (E57_ERROR_BAD_API_ARGUMENT)

is there a way to discover what the fieldnames being used are? - I just want to extract the X,Y,Z pointcloud. to .csv.

JerryJiehanWang commented 3 years ago

Adding the `Unsupported point field name to here: https://github.com/davidcaron/pye57/blob/master/pye57/e57.py#L19 Solved my problem.

RaphaelWag commented 3 years ago

I had the same problem and I solved it by doing the following: First go into /usr/local/lib/python3.7/dist-packages/pye57 then change the e57.py file by adding a print(header.point_fields) in line 121 in the read_scan_raw() function. run your code where you load your e57 data file and it will print a list of all fields. Then go into line 29 of the e57.py file and all all missing field in the SUPPORTED_POINT_FIELDS dict Afterwards remove the print function you added in the read_scan_raw() function.

nevilamos commented 3 years ago

Thanks

On Mon, 22 Mar 2021 at 20:07, RaphaelWag @.***> wrote:

I had the same problem and I solved it by doing the following: First go into /usr/local/lib/python3.7/dist-packages/pye57 then change the e57.py file by adding a print(header.point_fields) in line 121 in the read_scan_raw() function. run your code where you load your e57 data file and it will print a list of all fields. Then go into line 29 of the e57.py file and all all missing field in the SUPPORTED_POINT_FIELDS dict Afterwards remove the print function you added in the read_scan_raw() function.

— You are receiving this because you commented. Reply to this email directly, view it on GitHub https://github.com/davidcaron/pye57/issues/6#issuecomment-803894677, or unsubscribe https://github.com/notifications/unsubscribe-auth/ALKPWC3CTQYQCX6222SJMMTTE4CG5ANCNFSM4G5SHMVA .

davidcaron commented 2 years ago

Hi, I believe 0.3.1 should handle these file types, where cartesianInvalidState is absent.

In particular, in this commit: https://github.com/davidcaron/pye57/commit/eb8d446494445881c998a7ffd5b965a4cf6bd2f2

Feel free to reopen if you still have issues.

edips commented 1 year ago

Hi, I got an error when I open e57 file exported from CloudCompare:

  File "C:\Users\Edip\Desktop\Projects\Open3D\Mesh_Generator.py", line 13, in <module>
    data = e57.read_scan_raw( 0 )
  File "C:\Users\Edip\anaconda3\lib\site-packages\pye57\e57.py", line 139, in read_scan_raw
    np_array, buffer = self.make_buffer(field, header.point_count)
  File "C:\Users\Edip\anaconda3\lib\site-packages\pye57\e57.py", line 114, in make_buffer
    raise ValueError("Unsupported point field: %s" % field_name)
ValueError: Unsupported point field: nor:normalX
edips commented 1 year ago

Now I tried another e57 file. I get the error:

raise ValueError("Requested to read a field (%s) with is absent from the e57 file. "
ValueError: Requested to read a field (cartesianInvalidState) with is absent from the e57 file. Consider using 'ignore_missing_fields' to skip it.