1
Python and Java API / Re: List of camera labels in a chunk which are not aligned
« on: July 29, 2023, 09:09:04 AM »
Thank you so much for your help, paulo
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.
Why is it getting freezed? is it because progress_print prints too many lines??
if that is the reason, you can test a workaround..Code: [Select]import time, PhotoScan
def progress_print(p):
elapsed = float(time.time() - start_time)
if p:
sec = elapsed / p * 100
print('Current task progress: {:.2f}%, estimated time left: {:.0f} seconds'.format(p, sec), end="\r", flush=True)
else:
print('Current task progress: {:.2f}%, estimated time left: unknown'.format(p), end="\r", flush=True) #if 0% progress
chunk = PhotoScan.app.document.chunk
global start_time
start_time = time.time()
chunk.matchPhotos( progress=progress_print)
camera = Metashape.app.document.chunk.cameras[0]
print(camera.reference.enabled) #Prints True
print(camera.reference.location_enabled) #Prints True
camera.reference.enabled = False
print(camera.reference.enabled) #Prints False
print(camera.reference.location_enabled) #Prints False
camera.reference.location_enabled = True
print(camera.reference.enabled) #Prints True
print(camera.reference.location_enabled) #Prints True
import time, PhotoScan
def progress_print(p):
elapsed = float(time.time() - start_time)
if p:
sec = elapsed / p * 100
print('Current task progress: {:.2f}%, estimated time left: {:.0f} seconds'.format(p, sec), end="\r", flush=True)
else:
print('Current task progress: {:.2f}%, estimated time left: unknown'.format(p), end="\r", flush=True) #if 0% progress
chunk = PhotoScan.app.document.chunk
global start_time
start_time = time.time()
chunk.matchPhotos( progress=progress_print)
task = Metashape.Tasks.MergeChunks()
task.chunks = [chunk.key for chunk in doc.chunks]
task.copy_point_clouds = True
task.merge_assets = True
task.supports_gpu = True
task.apply(doc)
chunk.matchPhotos(accuracy=Metashape.HighAccuracy,
generic_preselection=True,
reference_preselection=True,
keypoint_limit=40000,
tiepoint_limit=4000,
filter_mask=False,
mask_tiepoints=False,)
chunk.alignCameras(adaptive_fitting=True,)