Make functional global configuration

Former-commit-id: d22f05b3cc
pull/1161/head
Dakota Benjamin 2017-03-07 14:58:40 -05:00
rodzic 3b393cb2eb
commit aafb83e02e
5 zmienionych plików z 36 dodań i 22 usunięć

1
.gitignore vendored
Wyświetl plik

@ -19,3 +19,4 @@ ceres-solver.tar.gz
*.pyc
pcl.tar.gz
opencv.zip
settings.yaml

Wyświetl plik

@ -33,8 +33,9 @@ Current version: 0.2 (this software is in beta)
1. Extract and enter the OpenDroneMap directory
2. Run `bash configure.sh`
3. Download and extract a sample dataset [here](https://github.com/OpenDroneMap/odm_data_aukerman/archive/master.zip)
4. Run `./run.sh --project-path <PATH>`, replacing `<PATH>` with the dataset path.
4. Copy the default settings file and edit it: `cp default.settings.yaml settings.yaml`. Set the `project-path` value to an empty directory (you will place sub-directories containing individual projects inside). You can add many options to this file, [see here](https://github.com/OpenDroneMap/OpenDroneMap/wiki/Run-Time-Parameters)
3. Download a sample dataset from [here](https://github.com/OpenDroneMap/odm_data_aukerman/archive/master.zip) (about 550MB) and extract it as a subdirectory in your project directory.
4. Run `./run.sh odm_data_aukerman`
5. Enter dataset directory to view results:
- orthophoto: odm_orthophoto/odm_orthophoto.tif
- textured mesh model: odm_texturing/odm_textured_model_geo.obj
@ -65,13 +66,24 @@ Note that using `run.sh` sets these temporarily in the shell.
### Run OpenDroneMap
First you need a set of images, taken from a drone or otherwise. Example data can be cloned from https://github.com/OpenDroneMap/odm_data
First you need a set of images, taken from a drone or otherwise. Example data can be obtained from https://github.com/OpenDroneMap/odm_data
Next, you need to copy over the settings file `default.settings.yaml` and edit it. The only setting you must edit is the `project-path` key. Set this to an empty directory within projects will be saved. There are many options for tuning your project. See the [wiki](https://github.com/OpenDroneMap/OpenDroneMap/wiki/Run-Time-Parameters) or run `python run.py -h`
Then run:
python run.py --project-path /path/to/project -i /path/to/images
python run.py -i /path/to/images project-name
The images will be copied over to the project path so you only need to specify the `-i /path/` once. There are many options for tuning your project. See the [wiki](https://github.com/OpenDroneMap/OpenDroneMap/wiki/Run-Time-Parameters) or run `python run.py -h`
The images will be copied over to the project path so you only need to specify the `-i /path/` once. You can also override any variable from settings.yaml here using the command line arguments. If you want to rerun the whole thing, run
python run.py --rerun-all project-name
or
python run.py --rerun-from odm_meshing project-name
The options for rerunning are: 'resize', 'opensfm', 'slam', 'cmvs', 'pmvs', 'odm_meshing', 'mvs_texturing', 'odm_georeferencing', 'odm_orthophoto'
### View Results
@ -85,10 +97,8 @@ When the process finishes, the results will be organized as follows:
|-- ...
|-- opensfm/
|-- see mapillary/opensfm repository for more info
|-- pmvs/
|-- recon0/
|-- models/
|-- option-0000.ply # Dense point cloud (not georeferenced)
|-- depthmaps/
|-- merged.ply # Dense Point cloud (not georeferenced)
|-- odm_meshing/
|-- odm_mesh.ply # A 3D mesh
|-- odm_meshing_log.txt # Output of the meshing task. May point out errors.
@ -102,13 +112,13 @@ When the process finishes, the results will be organized as follows:
|-- odm_georeferenced_model.csv # XYZ format point cloud
|-- odm_georeferencing_log.txt # Georeferencing log
|-- odm_georeferencing_utm_log.txt # Log for the extract_utm portion
|-- odm_georeferencing/
|-- odm_orthophoto/
|-- odm_orthophoto.png # Orthophoto image (no coordinates)
|-- odm_orthophoto.tif # Orthophoto GeoTiff
|-- odm_orthophoto_log.txt # Log file
|-- gdal_translate_log.txt # Log for georeferencing the png file
Any file ending in .obj or .ply can be opened and viewed in [MeshLab](http://meshlab.sourceforge.net/) or similar software. That includes `pmvs/recon0/models/option-000.ply`, `odm_meshing/odm_mesh.ply`, `odm_texturing/odm_textured_model[_geo].obj`, or `odm_georeferencing/odm_georeferenced_model.ply`. Below is an example textured mesh:
Any file ending in .obj or .ply can be opened and viewed in [MeshLab](http://meshlab.sourceforge.net/) or similar software. That includes `opensfm/depthmaps/merged.ply`, `odm_meshing/odm_mesh.ply`, `odm_texturing/odm_textured_model[_geo].obj`, or `odm_georeferencing/odm_georeferenced_model.ply`. Below is an example textured mesh:
![](https://raw.githubusercontent.com/alexhagiopol/OpenDroneMap/feature-better-docker/toledo_dataset_example_mesh.jpg)

Wyświetl plik

@ -1,6 +1,8 @@
---
# A list of global configuration variables
# Copy this file and rename to settings.yaml to override. You can also place the a settings.yaml
# file with the same format inside your project to more specific parameter needs.
settings:
- project_path: '/code/'
- project_path: '/home/dmb2/ODMProjects'
- opensfm_pointcloud: True
- opensfm_processes: 4
- opensfm_processes: 4 # Set this to nproc-2 for large datasets

Wyświetl plik

@ -1,5 +1,6 @@
import argparse
from opendm import context
import yaml
# parse arguments
processopts = ['resize', 'opensfm', 'slam', 'cmvs', 'pmvs',
@ -11,13 +12,15 @@ with open(context.settings_path) as stream:
datamap = yaml.safe_load(stream)
defaultSettings = datamap['settings']
def alphanumeric_string(string):
import re
if re.match('^[a-zA-Z0-9]+$', str) is None:
if re.match('^[a-zA-Z0-9]+$', string) is None:
msg = '{0} is not a valid name. Must use alphanumeric characters.'.format(string)
raise argparse.ArgumentTypeError(msg)
return string
class RerunFrom(argparse.Action):
def __call__(self, parser, namespace, values, option_string=None):
setattr(namespace, self.dest, processopts[processopts.index(values):])
@ -28,16 +31,16 @@ parser = argparse.ArgumentParser(description='OpenDroneMap')
def config():
parser.add_argument('--images', '-i',
metavar='<string>',
metavar='<path>',
help='Path to input images'),
parser.add_argument('--project-path',
metavar='<string>',
help='Path to the project to process',
metavar='<path>',
help='Path to the project folder',
default=defaultSettings[0]['project_path'])
parser.add_argument('name',
metavar='<string>',
metavar='<project name>',
type=alphanumeric_string,
help='Name of Project (i.e subdirectory of projects folder)')

6
run.py
Wyświetl plik

@ -25,14 +25,12 @@ if __name__ == '__main__':
args = config.config()
# Check that args.name is a valid string
proj_dir = io.join_paths(args.project_path, args.name)
# Force to provide the images path
if args.project_path is None:
usage()
if not io.dir_exists(args.name):
args.project_path = io.join_paths(args.project_path, args.name)
if not io.dir_exists(args.project_path):
log.ODM_WARNING('Directory %s does not exist. Creating it now.' % args.name)
system.mkdir_p(os.path.abspath(args.project_path))