2020-09-08 17:08:57 +00:00
|
|
|
#!/usr/bin/python3
|
|
|
|
|
|
|
|
# Basic check
|
|
|
|
import sys
|
|
|
|
if sys.version_info.major < 3:
|
|
|
|
print("Ups! ODM needs to run with Python 3. It seems you launched it with Python 2. Try using: python3 run.py ... ")
|
|
|
|
sys.exit(1)
|
2015-08-20 19:16:25 +00:00
|
|
|
|
2021-08-13 14:23:04 +00:00
|
|
|
import os
|
2015-12-22 12:29:13 +00:00
|
|
|
from opendm import log
|
|
|
|
from opendm import config
|
|
|
|
from opendm import system
|
2016-12-20 16:14:52 +00:00
|
|
|
from opendm import io
|
2019-05-15 21:04:09 +00:00
|
|
|
from opendm.progress import progressbc
|
2022-01-03 14:21:46 +00:00
|
|
|
from opendm.utils import get_processing_results_paths, rm_r
|
2021-06-08 18:25:38 +00:00
|
|
|
from opendm.loghelpers import args_to_dict
|
2015-08-27 12:59:35 +00:00
|
|
|
|
2019-05-06 19:42:49 +00:00
|
|
|
from stages.odm_app import ODMApp
|
2015-08-27 14:29:54 +00:00
|
|
|
|
2021-12-14 17:51:09 +00:00
|
|
|
def odm_version():
|
|
|
|
try:
|
|
|
|
with open("VERSION") as f:
|
|
|
|
return f.read().split("\n")[0].strip()
|
|
|
|
except:
|
|
|
|
return "?"
|
|
|
|
|
2015-08-27 12:59:35 +00:00
|
|
|
if __name__ == '__main__':
|
2016-03-08 18:26:58 +00:00
|
|
|
args = config.config()
|
|
|
|
|
2021-12-14 17:51:09 +00:00
|
|
|
log.ODM_INFO('Initializing ODM %s - %s' % (odm_version(), system.now()))
|
2017-02-09 23:57:24 +00:00
|
|
|
|
2019-05-19 19:34:03 +00:00
|
|
|
# Print args
|
2021-06-08 18:25:38 +00:00
|
|
|
args_dict = args_to_dict(args)
|
2019-06-28 15:10:08 +00:00
|
|
|
log.ODM_INFO('==============')
|
2021-06-08 18:25:38 +00:00
|
|
|
for k in args_dict.keys():
|
|
|
|
log.ODM_INFO('%s: %s' % (k, args_dict[k]))
|
2019-06-28 15:10:08 +00:00
|
|
|
log.ODM_INFO('==============')
|
2019-05-19 19:34:03 +00:00
|
|
|
|
2019-05-15 21:04:09 +00:00
|
|
|
progressbc.set_project_name(args.name)
|
|
|
|
|
2017-03-27 19:41:51 +00:00
|
|
|
# Add project dir if doesn't exist
|
2020-10-28 14:05:01 +00:00
|
|
|
args.project_path = os.path.join(args.project_path, args.name)
|
2017-03-07 19:58:40 +00:00
|
|
|
if not io.dir_exists(args.project_path):
|
2017-02-09 23:57:24 +00:00
|
|
|
log.ODM_WARNING('Directory %s does not exist. Creating it now.' % args.name)
|
2016-12-20 16:14:52 +00:00
|
|
|
system.mkdir_p(os.path.abspath(args.project_path))
|
2015-08-27 12:59:35 +00:00
|
|
|
|
2017-03-27 19:41:51 +00:00
|
|
|
# If user asks to rerun everything, delete all of the existing progress directories.
|
2016-07-18 22:02:37 +00:00
|
|
|
if args.rerun_all:
|
2019-06-28 15:10:08 +00:00
|
|
|
log.ODM_INFO("Rerun all -- Removing old data")
|
2022-01-03 14:21:46 +00:00
|
|
|
for d in [os.path.join(args.project_path, p) for p in get_processing_results_paths()] + [
|
|
|
|
os.path.join(args.project_path, "odm_meshing"),
|
|
|
|
os.path.join(args.project_path, "opensfm"),
|
|
|
|
os.path.join(args.project_path, "odm_texturing_25d"),
|
|
|
|
os.path.join(args.project_path, "odm_filterpoints"),
|
|
|
|
os.path.join(args.project_path, "submodels")]:
|
|
|
|
rm_r(d)
|
2019-04-22 19:14:39 +00:00
|
|
|
|
|
|
|
app = ODMApp(args)
|
2021-04-05 13:50:04 +00:00
|
|
|
retcode = app.execute()
|
2018-12-03 14:26:21 +00:00
|
|
|
|
2019-04-24 21:36:45 +00:00
|
|
|
# Do not show ASCII art for local submodels runs
|
2021-10-15 18:24:48 +00:00
|
|
|
if retcode == 0 and not "submodels" in args.project_path:
|
2019-04-24 21:36:45 +00:00
|
|
|
log.ODM_INFO('MMMMMMMMMMMNNNMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMNNNMMMMMMMMMMM')
|
|
|
|
log.ODM_INFO('MMMMMMdo:..---../sNMMMMMMMMMMMMMMMMMMMMMMMMMMNs/..---..:odMMMMMM')
|
|
|
|
log.ODM_INFO('MMMMy-.odNMMMMMNy/`/mMMMMMMMMMMMMMMMMMMMMMMm/`/hNMMMMMNdo.-yMMMM')
|
|
|
|
log.ODM_INFO('MMN/`sMMMMMMMMMNNMm/`yMMMMMMMMMMMMMMMMMMMMy`/mMNNMMMMMMMMNs`/MMM')
|
|
|
|
log.ODM_INFO('MM/ hMMMMMMMMNs.+MMM/ dMMMMMMMMMMMMMMMMMMh +MMM+.sNMMMMMMMMh +MM')
|
|
|
|
log.ODM_INFO('MN /MMMMMMNo/./mMMMMN :MMMMMMMMMMMMMMMMMM: NMMMMm/./oNMMMMMM: NM')
|
|
|
|
log.ODM_INFO('Mm +MMMMMN+ `/MMMMMMM`-MMMMMMMMMMMMMMMMMM-`MMMMMMM:` oNMMMMM+ mM')
|
|
|
|
log.ODM_INFO('MM..NMMNs./mNMMMMMMMy sMMMMMMMMMMMMMMMMMMo hMMMMMMMNm/.sNMMN`-MM')
|
|
|
|
log.ODM_INFO('MMd`:mMNomMMMMMMMMMy`:MMMMMMMNmmmmNMMMMMMN:`hMMMMMMMMMdoNMm-`dMM')
|
|
|
|
log.ODM_INFO('MMMm:.omMMMMMMMMNh/ sdmmho/.`..`-``-/sddh+ /hNMMMMMMMMdo.:mMMM')
|
|
|
|
log.ODM_INFO('MMMMMd+--/osss+:-:/` ```:- .ym+ hmo``:-` `+:-:ossso/-:+dMMMMM')
|
|
|
|
log.ODM_INFO('MMMMMMMNmhysosydmNMo /ds`/NMM+ hMMd..dh. sMNmdysosyhmNMMMMMMM')
|
|
|
|
log.ODM_INFO('MMMMMMMMMMMMMMMMMMMs .:-:``hmmN+ yNmds -:.:`-NMMMMMMMMMMMMMMMMMM')
|
|
|
|
log.ODM_INFO('MMMMMMMMMMMMMMMMMMN.-mNm- //:::. -:://: +mMd`-NMMMMMMMMMMMMMMMMM')
|
|
|
|
log.ODM_INFO('MMMMMMMMMMMMMMMMMM+ dMMN -MMNNN+ yNNNMN :MMMs sMMMMMMMMMMMMMMMMM')
|
|
|
|
log.ODM_INFO('MMMMMMMMMMMMMMMMMM`.mmmy /mmmmm/ smmmmm``mmmh :MMMMMMMMMMMMMMMMM')
|
|
|
|
log.ODM_INFO('MMMMMMMMMMMMMMMMMM``:::- ./////. -:::::` :::: -MMMMMMMMMMMMMMMMM')
|
|
|
|
log.ODM_INFO('MMMMMMMMMMMMMMMMMM:`mNNd /NNNNN+ hNNNNN .NNNy +MMMMMMMMMMMMMMMMM')
|
|
|
|
log.ODM_INFO('MMMMMMMMMMMMMMMMMMd`/MMM.`ys+//. -/+oso +MMN.`mMMMMMMMMMMMMMMMMM')
|
|
|
|
log.ODM_INFO('MMMMMMMMMMMMMMMMMMMy /o:- `oyhd/ shys+ `-:s-`hMMMMMMMMMMMMMMMMMM')
|
|
|
|
log.ODM_INFO('MMMMMMMMNmdhhhdmNMMM` +d+ sMMM+ hMMN:`hh- sMMNmdhhhdmNMMMMMMMM')
|
|
|
|
log.ODM_INFO('MMMMMms:::/++//::+ho .+- /dM+ hNh- +/` -h+:://++/::/smMMMMM')
|
|
|
|
log.ODM_INFO('MMMN+./hmMMMMMMNds- ./oso:.``:. :-``.:os+- -sdNMMMMMMmy:.oNMMM')
|
|
|
|
log.ODM_INFO('MMm-.hMNhNMMMMMMMMNo`/MMMMMNdhyyyyhhdNMMMM+`oNMMMMMMMMNhNMh.-mMM')
|
|
|
|
log.ODM_INFO('MM:`mMMN/-sNNMMMMMMMo yMMMMMMMMMMMMMMMMMMy sMMMMMMMNNs-/NMMm`:MM')
|
|
|
|
log.ODM_INFO('Mm /MMMMMd/.-oMMMMMMN :MMMMMMMMMMMMMMMMMM-`MMMMMMMo-./dMMMMM/ NM')
|
|
|
|
log.ODM_INFO('Mm /MMMMMMm:-`sNMMMMN :MMMMMMMMMMMMMMMMMM-`MMMMMNs`-/NMMMMMM/ NM')
|
|
|
|
log.ODM_INFO('MM:`mMMMMMMMMd/-sMMMo yMMMMMMMMMMMMMMMMMMy sMMMs-/dMMMMMMMMd`:MM')
|
|
|
|
log.ODM_INFO('MMm-.hMMMMMMMMMdhMNo`+MMMMMMMMMMMMMMMMMMMM+`oNMhdMMMMMMMMMh.-mMM')
|
|
|
|
log.ODM_INFO('MMMNo./hmNMMMMMNms--yMMMMMMMMMMMMMMMMMMMMMMy--smNMMMMMNmy/.oNMMM')
|
|
|
|
log.ODM_INFO('MMMMMms:-:/+++/:-+hMMMMMMMMMMMMMMMMMMMMMMMMMNh+-:/+++/:-:smMMMMM')
|
|
|
|
log.ODM_INFO('MMMMMMMMNdhhyhdmMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMmdhyhhmNMMMMMMMM')
|
|
|
|
log.ODM_INFO('MMMMMMMMMMMMMMMNNNNNMMMMMMNNNNNNMMMMMMMMNNMMMMMMMNNMMMMMMMMMMMMM')
|
|
|
|
log.ODM_INFO('MMMMMMMMMMMMMh/-...-+dMMMm......:+hMMMMs../MMMMMo..sMMMMMMMMMMMM')
|
|
|
|
log.ODM_INFO('MMMMMMMMMMMM/ /yhy- sMMm -hhy/ :NMM+ oMMMy /MMMMMMMMMMMM')
|
|
|
|
log.ODM_INFO('MMMMMMMMMMMy /MMMMN` NMm /MMMMo +MM: .` yMd``` :MMMMMMMMMMMM')
|
|
|
|
log.ODM_INFO('MMMMMMMMMMM+ sMMMMM: hMm /MMMMd -MM- /s `h.`d- -MMMMMMMMMMMM')
|
|
|
|
log.ODM_INFO('MMMMMMMMMMMs +MMMMM. mMm /MMMMy /MM. +M/ yM: `MMMMMMMMMMMM')
|
|
|
|
log.ODM_INFO('MMMMMMMMMMMN- smNm/ +MMm :NNdo` .mMM` oMM+/yMM/ MMMMMMMMMMMM')
|
|
|
|
log.ODM_INFO('MMMMMMMMMMMMNo- `:yMMMm `:sNMMM` sMMMMMMM+ NMMMMMMMMMMM')
|
|
|
|
log.ODM_INFO('MMMMMMMMMMMMMMMNmmNMMMMMMMNmmmmNMMMMMMMNNMMMMMMMMMNNMMMMMMMMMMMM')
|
2021-04-05 13:50:04 +00:00
|
|
|
log.ODM_INFO('ODM app finished - %s' % system.now())
|
|
|
|
else:
|
|
|
|
exit(retcode)
|