agisoft-llc / metashape-scripts

Python scripts for Metashape (former PhotoScan)
MIT License
376 stars 204 forks source link

camera calibration export/import for scenes with multiple cameras script? #69

Closed henrypearce4D closed 11 months ago

henrypearce4D commented 11 months ago

Is there a script for saving camera calibration and loading it for multiple cameras? image image

The example shows one camera, is it possible to do this with a script for scenes with say 50 -200 different cameras (sensors)?

https://agisoft.freshdesk.com/support/solutions/articles/31000160059-lens-calibration-using-chessboard-pattern-in-metashape

PolarNick239 commented 11 months ago

Hi, how do you match each image with corresponding sensor? Photos taken from the same camera have the same name?

In such case you can use Export Cameras + Import Cameras, so intrinsics (focal length, cx, cy, etc.) and extrinsics (position and orientation) will be loaded. And after that you can reset alignment if you need to get rid of extrinsics - i.e. if you want to find position and orientation of cameras from scratch (but using imported interior parameters).

Also, you can do something similar to this script - i.e. use Metashape.Calibration.save() and Metashape.Calibration.load() - see Python API for details.

henrypearce4D commented 11 months ago

Thanks for the info. I did try Export / Export Cameras but the option was greyed out because I already reset the alignment. Good to know I can Import the Cameras with alignment then reset and then re-align.