OpenDroneMap-ODM/opendm/context.py

52 wiersze
1.7 KiB
Python

import os
import sys
import multiprocessing
# Define some needed locations
current_path = os.path.abspath(os.path.dirname(__file__))
root_path, _ = os.path.split(current_path)
superbuild_path = os.path.join(root_path, 'SuperBuild')
superbuild_bin_path = os.path.join(superbuild_path, 'install', 'bin')
# add opencv,opensfm to python path
python_packages_paths = [os.path.join(superbuild_path, p) for p in [
2021-09-02 22:12:18 +00:00
'install/lib/python3.9/dist-packages',
2020-11-06 20:13:51 +00:00
'install/lib/python3.8/dist-packages',
'install/lib/python3/dist-packages',
'install/bin/opensfm',
]]
for p in python_packages_paths:
sys.path.append(p)
# define opensfm path
2021-04-29 19:12:09 +00:00
opensfm_path = os.path.join(superbuild_bin_path, "opensfm")
2021-04-27 19:55:14 +00:00
poisson_recon_path = os.path.join(superbuild_bin_path, 'PoissonRecon')
2021-04-27 15:43:51 +00:00
dem2mesh_path = os.path.join(superbuild_bin_path, 'dem2mesh')
2021-04-27 18:53:49 +00:00
dem2points_path = os.path.join(superbuild_bin_path, 'dem2points')
# define mvstex path
2021-04-27 15:43:51 +00:00
mvstex_path = os.path.join(superbuild_bin_path, "texrecon")
2020-10-27 21:10:10 +00:00
# openmvs paths
2021-04-27 15:43:51 +00:00
omvs_densify_path = os.path.join(superbuild_bin_path, "OpenMVS", "DensifyPointCloud")
omvs_reconstructmesh_path = os.path.join(superbuild_bin_path, "OpenMVS", "ReconstructMesh")
2020-10-27 21:10:10 +00:00
2021-12-07 16:59:30 +00:00
fpcfilter_path = os.path.join(superbuild_bin_path, "FPCFilter")
odm_orthophoto_path = os.path.join(superbuild_bin_path, "odm_orthophoto")
settings_path = os.path.join(root_path, 'settings.yaml')
# Define supported image extensions
supported_extensions = {'.jpg','.jpeg','.png', '.tif', '.tiff', '.bmp'}
2023-01-26 17:07:15 +00:00
supported_video_extensions = {'.mp4', '.mov', '.lrv', '.ts'}
# Define the number of cores
num_cores = multiprocessing.cpu_count()
# Print python paths if invoked as a script
if __name__ == "__main__":
print("export PYTHONPATH=" + ":".join(python_packages_paths))