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

is_dense not properly set when loading PLY files #1455

Closed
VictorLamoine opened this issue Nov 30, 2015 · 7 comments
Closed

is_dense not properly set when loading PLY files #1455

VictorLamoine opened this issue Nov 30, 2015 · 7 comments
Labels
kind: bug Type of issue

Comments

@VictorLamoine
Copy link
Contributor

is_dense is wrongly set to false when loading a PLY cloud (reported here and here).
This line is responsible: io/src/ply_io.cpp#L62

Is must be set to true, and when adding vertex the variable should be set to false if one of the components is not finite.

Test code:
#1433

It should be tested within PCL:
#1381 (comment)

@SergioRAgostinho
Copy link
Member

👍 When you submit the PR for this can you please uncomment the lines in the color test?

@VictorLamoine
Copy link
Contributor Author

Ok but I'm not sure how should I check if the values are finite or not, I see 2 options:

  • Just before returning the ply loading function, loop through the cloud and search for non-finite values. Dumb & slow but easy to implement.
  • When parsing the values, if one is non-finite, change is_dense to false.

The scalar values are parsed here but I don't see an easy way to modify the is_dense property from here, it requires modifying the function signature.

@jspricke
Copy link
Member

jspricke commented Dec 2, 2015

Can't we check it in the global loop? I guess it's this one: https://github.com/PointCloudLibrary/pcl/blob/master/io/src/ply_io.cpp#L603

@VictorLamoine
Copy link
Contributor Author

We only go into this loop if the PLY file has the range_grid field.

@SergioRAgostinho
Copy link
Member

@VictorLamoine Notice that at some point, the value inferred in here needs to be stored on the pointcloud/blob. That happens further ahead, probably in whatever get's called in here.
Look at scalarPropertyDefinitionCallback and "friends" in ply_io.cpp. Eventually you'll find the callback which store the value on the cloud/blob. Sorry for not being precise, but I'm not on my development pc at the moment.

@SergioRAgostinho
Copy link
Member

I have the impression it takes place here.

Now the question for me is, under which conditions do you set is_dense to false? I know it happens when one of the coordinates from a point is set to NaN. Is this also valid for any other (float) scalar, one might need to parse, e.g. a normal? What happens if your scalar value is Inf?

@VictorLamoine
Copy link
Contributor Author

Yes it's exactly here, using pcl_isfinite works fine, I've just compiled PCL with that and it works;

    if (!pcl_isfinite (value))
      cloud_->is_dense = false;

I was about to ask the same question, the documentation is not very clear about this:
http://docs.pointclouds.org/trunk/classpcl_1_1_point_cloud.html#a3ca88d8ebf6f4f35acbc31cdfb38aa94

If the color is invalid, should we set the point cloud to non dense? Etc.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
kind: bug Type of issue
Projects
None yet
Development

No branches or pull requests

3 participants