Hi everyone,
I have written this script to set "pixel size" and "focal length" values in the entire project without having to re-enter them by hand in Metashape's camera calibration tool.
It works perfectly.
However, I would also like to integrate into this script a set of instructions to write in the "initial" tab the type = precalibrated, set "f" to a certain number and finally lock "f" (in fixed parameters), but I am having great difficulty getting this desired part of the script to work; can you give me a hand? Thanks.
import Metashape
# Desired values
pixel_size = (set pixel size)
focal_length = (set focal length)
# Access the current project
doc = Metashape.app.document
# Iterate through all chunks
for chunk in doc.chunks:
# Iterate through all chunks
for camera in chunk.cameras:
if camera.sensor is not None:
# Set the pixel size and focal length
camera.sensor.pixel_size = Metashape.Vector([pixel_size, pixel_size])
camera.sensor.focal_length = focal_length
# Save the document
doc.save()