1
Python and Java API / Re: Create chunk copy
« on: June 17, 2022, 07:17:57 PM »
Thanks. I forgot the () after .copy
This section allows you to view all posts made by this member. Note that you can only see posts made in areas you currently have access to.
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()
views = ["nadir", "oblique1", "oblique2", "oblique3", "oblique4"]
sens = dict()
for view in views:
sens[view] = chunk.addSensor()
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
photos = [os.path.join(data, f) for f in os.listdir(data) if f.endswith(".tif")]
chunk.addPhotos(photos)
project.save()
for camera in chunk.cameras:
for view in views:
if view in camera.label:
camera.sensor = sens[view]
project.save()