Un metodo per automatizzare ODM e' quello di utilizzare NodeODM
In estrema sintesi si mette in esecuzione su un server il docker con la seguente sintassi
docker run -p 3000:3000 opendronemap/nodeodm
In seguito da un client si puo' usare il seguente script Python per effettuare l'upload automatico di tutte le immagini in un folder e per impostare i parametri di lavoro. Al termine del task sul server i dati saranno reinviati in automatico al client
import os
import sys
sys.path.append('..')
from pprint import pprint
from pyodm import Node, exceptions
node = Node("192.168.1.125", 3000)
files = []
for dirname, dirnames, filenames in os.walk('./images/'):
for subdirname in dirnames:
files.append(os.path.join(dirname, subdirname))
for filename in filenames:
files.append(os.path.join(dirname, filename))
pprint(files)
try:
# Start a task
print("Uploading images...")
task = node.create_task(files,{'dsm': True, 'orthophoto-resolution': 4})
print(task.info())
try:
# This will block until the task is finished
# or will raise an exception
task.wait_for_completion()
print("Task completed, downloading results...")
# Retrieve results
task.download_assets("./results")
print("Assets saved in ./results (%s)" % os.listdir("./results"))
# Restart task and this time compute dtm
task.restart({'dtm': True})
task.wait_for_completion()
print("Task completed, downloading results...")
task.download_assets("./results_with_dtm")
print("Assets saved in ./results_with_dtm (%s)" % os.listdir("./results_with_dtm"))
except exceptions.TaskFailedError as e:
print("\n".join(task.output()))
except exceptions.NodeConnectionError as e:
print("Cannot connect: %s" % e)
except exceptions.NodeResponseError as e:
print("Error: %s" % e)