Hello Pierre,
The following code works at my side, the script is adding the photos at first, then creating the sensors (taking height and width from the default calibration group, based on loaded images):
import Metashape
import os
data = "D:\\Data"
project = Metashape.Document()
project.save(os.path.join(data, "project.psx"))
chunk = project.addChunk()
chunk.crs = Metashape.CoordinateSystem("EPSG::32616")
project.save()
photos = [os.path.join(data, f) for f in os.listdir(data) if f.endswith(".tif")]
chunk.addPhotos(photos)
views = ["nadir", "oblique1", "oblique2", "oblique3", "oblique4"]
sens = dict()
for view in views:
sens[view] = chunk.addSensor()
sens[view].height = chunk.sensors[0].height
sens[view].width = chunk.sensors[0].width
sens[view].label = view
sens[view].pixel_size = Metashape.Vector([0.00520, 0.00520])
if "oblique" in view:
sens[view].focal_length = 123.0
else:
sens[view].focal_length = 82.0
project.save()
for camera in chunk.cameras:
for view in views:
if view in camera.label:
camera.sensor = sens[view]
project.save()