Author: Jan Ziegler
Date: September 2024
The scripts automate several stages of photogrammetry processing in Agisoft Metashape, divided into two steps:
- Geco2024AlignDemOrthoExport: Handles camera alignment, reprojection error filtering, depth map and dense point cloud generation, DEM, and orthomosaic export.
- Geco2024GroundPointDTM: Focuses on classifying ground points and generating the DTM from classified points.
These scripts streamline the processing of multiple projects (but can also be run for single projects), ensuring consistent output formats across various steps.
Before running the scripts, certain steps must be completed in Agisoft Metashape. Follow this guide to set up your project and prepare it for automated processing.
-
Start a New Project:
- Open Agisoft Metashape and create a new project.
- Go to Workflow > Add Photos to load the images that you want to process.
-
Check Image Alignment:
- Ensure all images are properly loaded and contain the necessary metadata (such as RTK data if applicable).
-
Save the Project:
- Save the project using the following naming convention:
Where:
YYYYMMDD_site_name.psx
YYYYMMDD
: The date of the project.site_name
: A descriptive name for the project site.
Example:
- Save the project using the following naming convention:
20240901_lens.psx
- Name the Chunk:
- Each project should have at least one chunk.
- Rename the chunk using the same naming convention as the project:
YYYYMMDD_site_name
Example:
20240901_lens
- Set Primary Channel to Panchro (Band 3):
- Go to Tools > Set Primary Channel.
- Select Panchro (Band 3) as the primary channel to ensure you're working with the correct wavelength.
- Adjust Image Brightness:
- Adjust the image brightness if necessary by selecting Tools > Set Brightness.... Click Estimate and Apply.
- Ensure the images are not too dark or too bright, as this can affect the final outputs.
- Calibrate Reflectance:
- Go to Tools > Calibrate Reflectance.
- Press Locate Panels. If the panels are not automatically recognized, follow the instructions for manual panel detection in the Appendix here.
The values should look like this (sometimes you have to paste the value for Panchro manually to get the correct calibration): Blue 0.507825 Green 0.509237 Panchro 0.508196 Red 0.509254 Red edge 0.508659 NIR 0.506765 LWIR
Once the above settings are applied, save the project one more time before running the Python script.
This script will handle camera alignment, depth map and dense point cloud generation, DEM, and orthomosaic export.
-
Prepare the Environment:
- Ensure you have a Python environment with the Agisoft Metashape API installed.
-
Clone the Repository:
- Clone the repository containing the script:
git clone https://github.com/yourusername/repository-name.git
- Clone the repository containing the script:
-
Run the Pre-Processing Script:
- Execute the script in the terminal by specifying the path to the text file containing the project paths:
python Geco2024AlignDemOrthoExport.py project_paths.txt
The text file (
project_paths.txt
) should contain the paths of all the.psx
project files, each on a new line. Example: - Execute the script in the terminal by specifying the path to the text file containing the project paths:
/path/to/20240901_lens.psx /path/to/20240902_saillon.psx
yaml
- Outputs of the Pre-Processing Script:
- After the pre-processing script runs, you will find the following outputs in the
exports
directory for each project:- DEM (
YYYYMMDD_site_name_DEM.tif
) - Orthomosaic (
YYYYMMDD_site_name_Ortho.tif
) - The script skips ground point classification and DTM generation.
- DEM (
This script will handle the classification of ground points and generate the DTM from classified points.
- Run the Ground Point Classification and DTM Script:
- After the pre-processing script has been run, execute the second script to classify ground points and generate the DTM:
python Geco2024GroundPointDTM.py project_paths.txt
- Outputs of the Ground Point Classification and DTM Script:
- After this script runs, you will find the following additional outputs in the
exports
directory for each project:- DTM (
YYYYMMDD_site_name_DTM.tif
) - Processing report (
YYYYMMDD_site_name_report.pdf
)
- DTM (
- GPU Settings: Ensure that your system has GPU enabled for faster processing. The scripts include settings to leverage GPU acceleration for depth map generation.
- Error Handling: If the script encounters any errors, check the terminal output to diagnose issues with the input project files or settings.
Feel free to contribute to this repository by submitting pull requests or opening issues for feature requests or bug reports.
This guide ensures that the project is correctly set up before running the two Python scripts, following consistent naming conventions and adjusting key settings in Metashape.