def segmentGroundPlane():

    inputObj = om.findObjectByName('pointcloud snapshot')
    inputObj.setProperty('Visible', False)
    polyData = shallowCopy(inputObj.polyData)

    zvalues = vtkNumpy.getNumpyFromVtk(polyData, 'Points')[:,2]
    groundHeight = np.percentile(zvalues, 5)
    searchRegion = thresholdPoints(polyData, 'z', [0.3 - groundHeight, groundHeight + 0.3])

    updatePolyData(searchRegion, 'ground search region', parent=getDebugFolder(), colorByName='z', visible=False)

    _, origin, normal = applyPlaneFit(searchRegion, distanceThreshold=0.02, expectedNormal=[0,0,1], perpendicularAxis=[0,0,1], returnOrigin=True)

    points = vtkNumpy.getNumpyFromVtk(polyData, 'Points')
    dist = np.dot(points - origin, normal)
    vtkNumpy.addNumpyToVtk(polyData, dist, 'dist_to_plane')

    groundPoints = thresholdPoints(polyData, 'dist_to_plane', [-0.01, 0.01])
    scenePoints = thresholdPoints(polyData, 'dist_to_plane', [0.05, 10])

    updatePolyData(groundPoints, 'ground points', alpha=0.3)
    updatePolyData(scenePoints, 'scene points', alpha=0.3)

    #scenePoints = applyEuclideanClustering(scenePoints, clusterTolerance=0.10, minClusterSize=100, maxClusterSize=1e6)
    #updatePolyData(scenePoints, 'scene points', colorByName='cluster_labels')
dataset/ETHPy150Open RobotLocomotion/director/src/python/director/segmentation.py/segmentGroundPlane/swapped operands of `-`