Forum

Author Topic: processing time estimation  (Read 2515 times)

jpaton

  • Newbie
  • *
  • Posts: 12
    • View Profile
processing time estimation
« on: March 13, 2024, 03:11:48 PM »
Hi!
Is there a way to estimate the processing time usig the api?
In metashape you can see an estimation and i would like to implement that in my code...

Alexey Pasumansky

  • Agisoft Technical Support
  • Hero Member
  • *****
  • Posts: 15240
    • View Profile
Re: processing time estimation
« Reply #1 on: March 13, 2024, 04:57:25 PM »
Hello jpaton,

It can be done using progress callback argument. See an example below:

Code: [Select]
import time, Metashape
def progress_print(p):
elapsed = float(time.time() - start_time)
sec = 10E+6
if p:
sec = elapsed / p * 100
print('Current task progress: {:.2f}%, estimated time left: {:.0f} seconds'.format(p, sec))
else:
print('Current task progress: {:.2f}%, estimated time left: unknown'.format(p)) #if 0% progress
chunk = Metashape.app.document.chunk
global start_time
start_time = time.time()
chunk.matchPhotos(reset_matches = True, progress=progress_print)
Best regards,
Alexey Pasumansky,
Agisoft LLC