Forum

Author Topic: [python] Metashape.Metashape.PointCloud' object has no attribute 'points'  (Read 2868 times)

Paulov

  • Newbie
  • *
  • Posts: 43
    • View Profile
Hello,

I think there may be a bug since I'm trying to get the count of points in a .las file and I'm getting this error.

    points = point_cloud.points #collection of points
AttributeError: 'Metashape.Metashape.PointCloud' object has no attribute 'points'

that is what It is printed,

and poitn cloud is defined as 

point_cloud = chunk.point_cloud #current cloud

and is properly read since I get the logs on screen.

I checked the forums and the code seems corrrect, I checked python reference just in case this had changed, yet seems correct

"class PointCloud.Points
Collection of 3D points in the point cloud"

Could you please check?

version 2.01 build 16069
« Last Edit: May 18, 2023, 10:35:29 AM by Paulov »

Alexey Pasumansky

  • Agisoft Technical Support
  • Hero Member
  • *****
  • Posts: 14854
    • View Profile
Hello Paulov,

If you need to get the number of tie points, then use:
Code: [Select]
len(chunk.tie_points.points)

To get the number of points in the dense cloud the following clumsy command can be used:
Code: [Select]
int(str(chunk.point_cloud).split("'")[1].split(" ")[0])
Note that in the version 1.8 tie points could be accessed via chunk.point_cloud and dense cloud - via chunk.dense_cloud, whereas in the version 2.0 tie points have been renamed to chunk.tie_points and dense cloud to chunk.point_cloud. So keep that in mind, when adapting old version scripts for your needs.
Best regards,
Alexey Pasumansky,
Agisoft LLC