Forum

Author Topic: Integrating gradual selection process into network tasks.  (Read 1060 times)

smorf

  • Newbie
  • *
  • Posts: 3
    • View Profile
Integrating gradual selection process into network tasks.
« on: October 01, 2021, 05:49:34 PM »
Hi,

I'm trying to better understand how to use tasks for network processing. The demo scripts available on GitHub are great for implementing basic tasks.

I'm a bit confused, however, on how to implement custom tasks, such as those commonly used to implement gradual selection filtering of the sparse cloud.

for example, I use the following script snippet for filtering and removing points using a reconstruction uncertainty threshold. How could I include this as a task in my pipeline? Thx.

Code: [Select]

threshold_RU = 10

pointCount = len([p for p in chunk.point_cloud.points])

f.init(chunk, criterion = Metashape.PointCloud.Filter.ReconstructionUncertainty)
f.selectPoints(threshold_RU)

pointSelected = len([p for p in chunk.point_cloud.points if p.selected])

if pointSelected < (pointCount / 2):
    f.removePoints(threshold_RU)
    print("RU Threshold used: " + str(threshold_RU))
else:
    threshold_RU = int(threshold_RU) + 5
    f.selectPoints(threshold_RU)
    pointSelected = len([p for p in chunk.point_cloud.points if p.selected])
    if pointSelected < (pointCount / 2):
        f.removePoints(threshold_RU)
        print("RU Threshold used: " + str(threshold_RU))
    else:
        threshold_RU = int(threshold_RU) + 5
        f.removePoints(threshold_RU) # max threshold here is original + 10
        print("RU Threshold used: " + str(threshold_RU))