Forum

Author Topic: Can somebody give me a demo on use of Tasks.AddPhotos  (Read 1615 times)

qq88068100

  • Newbie
  • *
  • Posts: 6
    • View Profile
Can somebody give me a demo on use of Tasks.AddPhotos
« on: March 28, 2019, 06:16:10 AM »
Can somebody give me a demo on use of Tasks.AddPhotos

that I want to addPhotos in cluster, I didn't found the demo script about Tasks.AddPhotos

Thanks
« Last Edit: March 31, 2019, 05:56:31 AM by qq88068100 »

Alexey Pasumansky

  • Agisoft Technical Support
  • Hero Member
  • *****
  • Posts: 14843
    • View Profile
Re: Can somebody give me a demo on use of Tasks.AddPhotos
« Reply #1 on: April 22, 2019, 03:58:31 PM »
Hello,

Currently, unfortunately, there's a problem with this task via network, but we are going to fix it in the version 1.5.3 update.

It should work in the following way:

Code: [Select]
path = '//STORAGE/datasets/processing/test.psx'
root = '//STORAGE/datasets/'
paths = ['//STORAGE/datasets/training/DSC00580.JPG', '//STORAGE/datasets/training/DSC00581.JPG',  '//STORAGE/datasets/training/DSC00584.JPG']




doc = Metashape.Document()
doc.open(path) #loading existing project
chunk = doc.chunk #accessing existing empty chunk

network_tasks = list()

task = Metashape.Tasks.AddPhotos()
paths2 = [p.replace(root, "/") for p in paths] #switching to relative paths
task.filenames = ";".join(paths2) #modifying the list with semi-column delimiter

n_task = Metashape.NetworkTask()
n_task.name = task.name
n_task.params = task.encode()
n_task.frames.append((chunk.key, 0))
network_tasks.append(n_task)

client = Metashape.NetworkClient()
client.connect("192.168.0.2") #server ip
batch_id = client.createBatch(path[len(root):], network_tasks)
client.resumeBatch(batch_id)
Best regards,
Alexey Pasumansky,
Agisoft LLC