Forum

Author Topic: Python script to import point cloud, classify it and export it  (Read 1227 times)

Will

  • Newbie
  • *
  • Posts: 5
    • View Profile
Hello All,

I wonder if someone can help me to script this procedure :

1) Import a point cloud (.las) from a lidar.

2) Classify ground points.

3) Export this new point cloud classified in same format (.las)

I will appreciate any help  :-)


Have a nice day
William


« Last Edit: July 29, 2021, 01:04:58 PM by Will »

Paulo

  • Hero Member
  • *****
  • Posts: 804
    • View Profile
Re: Python script to import point cloud, classify it and export it
« Reply #1 on: July 29, 2021, 03:33:19 PM »
Hello Will,

I think you should look at following 3 methods to build your script:
  • Metashape.app.document.chunk.importPoints(path=’‘, format=Metashape.PointsFormatLAS, calculate_normals=True[, crs ][, shift ][,progress]) # importing LAS file
  • Metashape.app.document.chunk.dense_cloud.classifyGroundPoints(max_angle=15.0, max_distance=1.0, cell_size=50.0[, source ][, progress]) # classifying imported dense cloud
  • Metashape.app.document.chunk.exportPoints(path=’‘, source_data=DenseCloudData, binary=True, save_normals=True,save_colors=True, save_classes=True, save_confidence=True,
    raster_transform=RasterTransformNone, colors_rgb_8bit=True, comment=’‘,save_comment=True, format=Metashape.PointsFormatLAS, image_format=ImageFormatJPEG[, crs ][, shift ][, region ], clip_to_boundary=True,block_width=1000, block_height=1000, split_in_blocks=False[, classes ],save_images=False[, viewpoint ], subdivide_task=True[, progress ]) # exporting to  LAS file

Then consult pages 34, 39, 51 of API reference guide https://www.agisoft.com/pdf/metashape_python_api_1_7_3.pdf for details on parameters to use for each method...
« Last Edit: July 29, 2021, 03:36:14 PM by Paulo »
Best Regards,

Paul Pelletier

Will

  • Newbie
  • *
  • Posts: 5
    • View Profile
Re: Python script to import point cloud, classify it and export it
« Reply #2 on: July 29, 2021, 03:44:26 PM »
Hello Paul,

you helped me again!! thank you.. :-)

Yes, forgot to the API refernce guide.


Thank you again and best regards

William