Agisoft Metashape Professional 2
This script is designed to be run directly within the Metashape "Run Script" dialog or integrated into a custom menu plugin.
# -*- coding: utf-8 -*- """ Agisoft Metashape Professional 2 - Feature Script Feature: Automated Vegetation Classification & DTM Generation Author: AI Assistant Version: 1.0 Compatible: Metashape Pro 2.x """import Metashape from PySide2 import QtWidgets, QtCore
class DTMGeneratorDialog(QtWidgets.QDialog): """ GUI Dialog for configuring the DTM generation parameters. """ def init(self, parent=None): super(DTMGeneratorDialog, self).init(parent)
self.setWindowTitle("Auto Vegetation & DTM Tool") self.setMinimumWidth(300) layout = QtWidgets.QVBoxLayout() # Preset Selector self.form_layout = QtWidgets.QFormLayout() self.preset_combo = QtWidgets.QComboBox() self.preset_combo.addItems(["Light Vegetation (Grass/Fields)", "Medium Vegetation (Orchards)", "Dense Forest"]) self.form_layout.addRow("Environment:", self.preset_combo) # Advanced Parameters self.cell_size_spin = QtWidgets.QDoubleSpinBox() self.cell_size_spin.setRange(0.1, 50.0) self.cell_size_spin.setValue(2.0) # Default 2 meters self.form_layout.addRow("Cell Size (m):", self.cell_size_spin) self.max_terrain_angle = QtWidgets.QDoubleSpinBox() self.max_terrain_angle.setRange(0, 90) self.max_terrain_angle.setValue(15.0) self.form_layout.addRow("Max Slope (deg):", self.max_terrain_angle) layout.addLayout(self.form_layout) # Buttons self.btn_run = QtWidgets.QPushButton("Process DTM") layout.addWidget(self.btn_run) self.btn_run.clicked.connect(self.accept) self.setLayout(layout) def get_params(self): """Returns the parameters selected by the user.""" preset = self.preset_combo.currentIndex() return "preset": preset, "cell_size": self.cell_size_spin.value(), "max_slope": self.max_terrain_angle.value()def classify_ground_and_vegetation(params): """ Core logic to separate ground and vegetation points. """ doc = Metashape.app.document chunk = doc.chunk
if not chunk: Metashape.app.messageBox("No active chunk found!") return False if not chunk.point_cloud: Metashape.app.messageBox("No point cloud found. Please align photos and build dense cloud first.") return False print(f"Starting Classification with params: params") # 1. Reset Classification (Optional, good for debugging) # chunk.point_cloud.resetClasses() # 2. Progressive Morphological Filter (Ground Classification) # This identifies points that fit a surface model within the cell size and slope constraints. # Mapping Presets to Filter Arguments # Preset 0: Light, Preset 1: Medium, Preset 2: Dense max_road_height = [0.5, 2.0, 5.0][params['preset']] # Max height of non-ground object print("Running Ground Classification Filter...") # Metashape 2.x specific API for ground filtering # We attempt to classify Class 2 (Ground) try: chunk.point_cloud.classifyGroundPoints( max_angle=params['max_slope'], max_distance=max_road_height, cell_size=params['cell_size'], classes=[Metashape.PointClass.Created, Metashape.PointClass.Unclassified] # Process unclassified points ) print("Ground classification complete.") except Exception as e: print(f"Error during ground classification: e") return False # 3. Vegetation Identification Logic # Any point NOT classified as Ground, but high above the ground plane, is Vegetation. # We can use a distance filter or simply assume remaining unclassified points in height ranges are vegetation. # For this feature, we will assume standard Photogrammetry logic: # Points significantly higher than the 'Ground' surface in the local cell are Vegetation. print("Refining Vegetation Classes...") # We use a custom logic here: # Reclassify 'Unclassified' points that are > 0.5m above nearest 'Ground' point
Agisoft Metashape Professional 2.0 (and its subsequent updates like 2.1 and 2.2) represents a major evolution of the photogrammetry software, transitioning from a purely image-based tool to a hybrid platform that integrates LiDAR data processing. Key Evolutionary Features agisoft metashape professional 2
The release of version 2.0 and later introduced several technical milestones:
LiDAR & Laser Scan Integration: The most significant addition is native support for terrestrial and aerial LiDAR. Users can now co-process images with laser scans to improve the accuracy of 3D models and digital elevation models (DEMs).
Enhanced Reconstruction: The software uses both photogrammetric depth maps and laser scans during mesh and tiled model generation.
Smart Automation (AI): New versions include AI-based background masking to automatically isolate subjects and advanced powerline detection for large-scale infrastructure projects.
Operational Safety: A new intermediate saving feature allows processing to resume automatically from the last successful subtask in the event of a power failure or system crash.
Workflow Adjustments: Version 2.x renamed certain traditional steps; for example, "Build Dense Cloud" was replaced with "Build Point Cloud". Professional vs. Standard Edition This script is designed to be run directly
While both editions share the same core engine, the Professional Edition is specifically designed for high-precision GIS and surveying tasks. Metashape Professional 2.x Metashape Standard 2.x Input Sources Aerial, close-range, satellite, LiDAR Close-range, aerial GIS Tools Georeferencing, GCP support, DTM/DSM Basic 3D modeling only Automation Python/Java API, Batch processing Advanced Tools Multispectral indices (NDVI), volume measurement Practical Applications Professional Edition - Agisoft Metashape
Features * Photogrammetric triangulation. Processing of various types of imagery: aerial (nadir, oblique), close-range, satellite. Agisoft Metashape Agisoft Metashape 2.0.0 pre-release
Agisoft Metashape Professional version 2.x introduces major enhancements to LiDAR data processing workflow automation AI-driven tools . Users with an existing 1.x license can upgrade to version 2.x for free
, though Professional users must re-activate their license due to a new activation system. Agisoft Metashape Key New Features in Version 2.x Enhanced LiDAR Integration
: Version 2.0 now supports combined evaluation of aerial and terrestrial laser scan data with photogrammetric imagery. It preserves point attributes like return number, intensity, and scan angle. AI-Based Masking
: Version 2.2 introduced an AI-powered masking method to automate background removal. Automatic Saving & Recovery aerial GIS Tools Georeferencing
: A "Save project after each step" option was added to major workflow commands, allowing users to resume processing automatically after power failures or crashes. Advanced LiDAR Calibration
: Supports boresight calibration for aerial LiDAR and allows measuring point cloud accuracy using check point coordinates. Texture Enhancements
: Recent updates (v2.3.0) added a "Natural" blending mode for textures and tools for patching textures directly in the Model view. Agisoft Metashape Updated Core Workflow
While the interface has been slightly reorganized, the fundamental photogrammetry steps remain consistent: Licensing Options - Agisoft Metashape
| Component | Minimum | Recommended | |-----------|---------|--------------| | CPU | 4-core | 12+ core (AMD 7950X / Intel 13900K) | | RAM | 16 GB | 64 GB (128 GB for 1000+ images) | | GPU | 4 GB VRAM, OpenGL 4.5 | 12+ GB VRAM (RTX 4080/4090) | | Storage | SSD 100 GB | NVMe 1 TB+ |
At its core, Agisoft Metashape Professional 2 is a standalone software product that performs photogrammetric processing of digital images and 4D reconstruction. It takes thousands of overlapping 2D photos—captured by drones, terrestrial cameras, or even smartphones—and generates high-resolution 3D spatial data, including dense point clouds, textured polygonal meshes, digital elevation models (DEMs), georeferenced orthomosaics, and 3D models ready for export to CAD, GIS, or game engines.
Version 2 is not merely a patch or a service update; it represents a fundamental overhaul of the processing pipeline, leveraging modern GPU architectures and introducing AI-assisted workflows.