Forum

Author Topic: Classifying point cloud according to chunk.label  (Read 2471 times)

Thibaud Capra

  • Full Member
  • ***
  • Posts: 101
  • Master Student in Geodetic Engineering & Surveying
    • View Profile
    • INSA de Strasbourg, Topography Engineering (French)
Classifying point cloud according to chunk.label
« on: February 24, 2017, 12:31:17 PM »
Hello,
I'm trying to refine a script I've been working on to automate even more parts. This time, depending on how the chunk has been automatically labeled previously, I want to filter or not my point cloud.

Here's my code (Python API 1.2.0), currently not working:

Code: [Select]
import os
import PhotoScan

print(""">>> Initialisation du script <<<""")

doc = PhotoScan.app.document
chunk = doc.addChunk()
type_chunk = ['Green']

for chunk in doc.chunks:
    # Build Dense Cloud
    chunk.buildDenseCloud(quality=PhotoScan.MediumQuality,
    filter=PhotoScan.AggressiveFiltering)
   
    # Classify Point Cloud depending on chunk type
    if not any(type_chunk in chunk.label for type_chunk in type_chunk):
        PhotoScan.DenseCloud.classifyGroundPoints(max_angle = 15.0,
        max_distance = 0.3, cell_size = 1.0)
    else:
        continue
    print("""--------------------- DPC OK ----------------""")
   
    # Build Mesh, then Smooth Mesh depending on chunk type
    if not any(type_chunk in chunk.label for type_chunk in type_chunk):
        chunk.buildModel(surface = PhotoScan.HeightField,
        interpolation = PhotoScan.EnabledInterpolation,
        face_count = PhotoScan.MediumFaceCount, classes = 1)
        chunk.smoothModel(passes = 50)
    else:
        chunk.buildModel(surface = PhotoScan.HeightField,
        interpolation = PhotoScan.EnabledInterpolation,
        face_count = PhotoScan.MediumFaceCount)
        chunk.smoothModel(passes = 100)

Error message:
TypeError: descriptor "classifyGroundPoints' of 'PhotoScan.DenseCloud' object needs an argument

Also, when building the model, i assumed the correct integer for ground points was 1. What's the correct one?

Best regards
« Last Edit: February 24, 2017, 12:41:40 PM by Thibaud Capra »
Best regards.
--
Thibaud CAPRA
Master Student in Geodetic Engineering, Cartography & Surveying
Master Thesis in Automated Processing of UAV-based Photogrammetric Data (ResearchGate Link)
INSA de Strasbourg, FRANCE
--