Scripting and automation¶
Cross-cutting articles on driving Metashape from the Python API: math-focused recipes, coordinate-system utilities, and visibility / projection patterns. Companion to Workflow → Scripting & automation, which covers procedural workflow scripts.
The Metashape Python API is Professional-edition only. Scripts here will not run in Standard.
Articles¶
- Scripting context pitfalls: GUI vs command-line, document handles, and stage validation
- YPR rotation conventions: ypr2mat vs camera.reference.rotation
- The chunk's internal coordinate system: arbitrary scale and chunk.transform.scale
- Working with shape geometries (1.7+ API)
- Creating point shapes programmatically: grid placement with DEM-based elevation
camera.projectandcamera.unproject: 2D ↔ 3D in Python- Converting
camera.transformto ENU - Computing camera direction vectors and look-at points
- Computing per-camera coverage area
- Mapping orthomosaic pixels back to source images
- Filtering cameras by tie-point selection: which photos see this 3D point?
- Mesh and point-cloud editing recipes (Python)
Model.renderDepth: synthetic depth from arbitrary viewpoints- Rendering models from synthetic cameras: spherical panoramas and regular views
- Comparing chunks for change detection: DEM, mesh, point-cloud diff
- Aligning two meshes / point clouds: model-to-model registration in Python
- Diagnostic mesh visualisation: colorize by overlap or altitude
- Undocumented tweaks: a partial reference
Related sections¶
- Workflow → Scripting & automation — procedural automation scripts (gradual-selection loops, logging from headless runs).
- Topics → CRS & georeferencing — the coordinate-system distinctions these recipes depend on.
- Topics → Performance & GPU — for when scripts hit GPU-pipeline issues during dense-cloud / depth-maps stages.