1
Python and Java API / Re: progress callback - issues with dense cloud
« on: January 24, 2023, 09:24:49 AM »
l
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.
def progress_bar_print(p):
global n
if not 'n' in globals():
n = datetime.now()
dif = datetime.now() - n
# If the last progress print was less than .5 seconds, don't print
if dif.seconds > .5:
print('Current task progress: {:.2f}% '.format(p),end="\r")
n = datetime.now()
else:
return False
# Dense cloud
dense = Metashape.Tasks.BuildDenseCloud()
dense.keep_depth = False
dense.point_colors = True
dense.point_confidence = False
for i in range(0,len(chunk_dict)):
st = datetime.now()
print('Building Depth Maps for {}'.format(doc.chunks[i].label))
depth.apply(doc.chunks[i], progress=progress_bar_print)
print('Task Complete ')
fin = datetime.now() - st
print('Finished {} in {} seconds\n'.format(doc.chunks[i].label, fin.seconds))
doc.save()
for i in range(0,len(chunk_dict)):
st = datetime.now()
print('Building Dense Cloud for {}'.format(doc.chunks[i].label))
dense.apply(doc.chunks[i], progress=progress_bar_print)
print('Task Complete ')
fin = datetime.now() - st
print('Finished {} in {} seconds\n'.format(doc.chunks[i].label, fin.seconds))
doc.save()
Metashape.License().activateOffline('C:\Program Files\Agisoft\Metashape Pro\metashape.lic')
import Metashape
Metashape.License().activate("xxxx-xxxx-xxxx-xxxx")
---------------------------------------------------------------------------
RuntimeError Traceback (most recent call last)
~\AppData\Local\Temp/ipykernel_13284/4131372149.py in <module>
1 import Metashape
----> 2 Metashape.License().activate("xxxx-xxxx-xxxx-xxxx")
RuntimeError: Unexpected error occurred
import os, MetaShape
dir_projects = 'E:/...//' #Directory folders with pictures
foldernames = os.listdir(dir_projects)
for i in range (0,len(foldernames)):
doc=PhotoScan.app.document
chunk = doc.addChunk()
# Implement Batch Here
doc.save()
doc.clear()