Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

update ply_io and filter_branch.py #1

Open
wants to merge 3 commits into
base: main
Choose a base branch
from

Conversation

wanxinyang
Copy link

ply_io.py

  1. .ply exported from CloudCompare has "scalar_" in property names, so add a if statement to remove "scalar_" and get expected names.
  2. If there is NAN values in any of the properties, read_ply() fails. So add a step to remove NAN values when read data from ply files.

filter_branch.py

  1. Currently, qrdar library reports some error when import it, so I change to import read_ply() and write_ply() from ply_io.py instead of qrdar.io
  2. Add reflectance filtering [-20, 5] in case of RiEGL VZ400i records values down < -30dB.

@@ -29,15 +29,22 @@ def read_ply(fp, newline=None):
if 'element face' in line:
raise Exception('.ply appears to be a mesh')
if 'end_header' in line: break


for j in range(len(prop)):
Copy link
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Instead of adding this section I would change line 28 to prop.append(line.split()[2].replace('scalar_', ''))

else:
arr = np.loadtxt(ply)
Copy link
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Why are there NaN values?

Also this below is slightly more succinct?

    if fmt == 'binary':
        arr = np.fromfile(ply, dtype=','.join(dtype))
        df = pd.DataFrame(data=arr, columns=prop)
    else:
        df = pd.read_csv(ply, sep='\s+', names=prop, header=None)
       
    df = df.dropna()  # drop rows with NAN values

Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The last point of an extracted cloud has NAN values in the last two columns (it does not have the last two properties), which caused filter_branch.py stopped running.

Yes, I agree. Moving df.dropna() out of the if statement is more succinct. Thanks.

Copy link
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

OK, how is the cloud being written in the first place before being read here as I think there must be an underlying issue. Dropping NaN here is a fix but could hide other errors e.g. what if it was the last 10,000 lines? I think I would put this outside the ply_io function.

@Philip035
Copy link

The qrdar library still can't be imported now.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants