kopia lustrzana https://github.com/OpenDroneMap/ODM
Merge pull request #17 from dakotabenjamin/cmake-changes
Update matcher args, opensfm url, and ccd_defs_checkpull/249/head
commit
d985e94ad5
|
@ -8,8 +8,8 @@ ExternalProject_Add(${_proj_name}
|
||||||
STAMP_DIR ${_SB_BINARY_DIR}/stamp
|
STAMP_DIR ${_SB_BINARY_DIR}/stamp
|
||||||
#--Download step--------------
|
#--Download step--------------
|
||||||
DOWNLOAD_DIR ${SB_DOWNLOAD_DIR}
|
DOWNLOAD_DIR ${SB_DOWNLOAD_DIR}
|
||||||
URL https://github.com/mapillary/OpenSfM/archive/odm-2.zip
|
URL https://github.com/mapillary/OpenSfM/archive/a4b07056aec1184692c1432fbdd1074710aec32b.zip
|
||||||
URL_MD5 2D56E04D7130E7A9D266BDBAC0539C47
|
URL_MD5 42B2B1994C3309BBF4525C8CC1F6F741
|
||||||
#--Update/Patch step----------
|
#--Update/Patch step----------
|
||||||
UPDATE_COMMAND ""
|
UPDATE_COMMAND ""
|
||||||
#--Configure step-------------
|
#--Configure step-------------
|
||||||
|
|
|
@ -0,0 +1,25 @@
|
||||||
|
#!/usr/bin/python
|
||||||
|
import sys
|
||||||
|
import os
|
||||||
|
import json
|
||||||
|
|
||||||
|
BIN_PATH_ABS = os.path.abspath(os.path.dirname(os.path.abspath(__file__)))
|
||||||
|
|
||||||
|
def get_ccd_widths():
|
||||||
|
"""Return the CCD Width of the camera listed in the JSON defs file."""
|
||||||
|
with open(BIN_PATH_ABS + '/data/ccd_defs.json') as jsonFile:
|
||||||
|
return json.load(jsonFile)
|
||||||
|
|
||||||
|
try:
|
||||||
|
ccd_defs = get_ccd_widths()
|
||||||
|
print "CCD_DEFS compiles OK"
|
||||||
|
print "Definitions in file: {0}".format(len(ccd_defs))
|
||||||
|
exit_code=0
|
||||||
|
except IOError as e:
|
||||||
|
print "I/O error with CCD_DEFS file: {0}".format(e.strerror)
|
||||||
|
exit_code=255
|
||||||
|
except:
|
||||||
|
print "Error with CCD_DEFS file: {0}".format(sys.exc_info()[1])
|
||||||
|
exit_code=255
|
||||||
|
|
||||||
|
sys.exit(exit_code)
|
|
@ -10,13 +10,14 @@
|
||||||
exec 1>&2
|
exec 1>&2
|
||||||
|
|
||||||
echo "RUNNING PRE-COMMIT"
|
echo "RUNNING PRE-COMMIT"
|
||||||
|
EXIT_CODE=0
|
||||||
# Get list of files about to be committed
|
# Get list of files about to be committed
|
||||||
if git diff --cached --name-only --diff-filter=ACM | grep 'ccd_defs.json'; then
|
if git diff --cached --name-only --diff-filter=ACM | grep 'ccd_defs.json'; then
|
||||||
echo "We changed ccd_defs.json"
|
echo "We changed ccd_defs.json"
|
||||||
GIT_ROOT=$(git rev-parse --show-toplevel)
|
GIT_ROOT=$(git rev-parse --show-toplevel)
|
||||||
perl $GIT_ROOT/ccd_defs_check.pl
|
python $GIT_ROOT/ccd_defs_check.py
|
||||||
|
EXIT_CODE=$(echo $?)
|
||||||
fi
|
fi
|
||||||
|
|
||||||
# non-zero exit fails the commit
|
# non-zero exit fails the commit
|
||||||
exit 0
|
exit $EXIT_CODE
|
||||||
|
|
|
@ -50,56 +50,49 @@ parser.add_argument('--min-num-features',
|
||||||
type=int,
|
type=int,
|
||||||
help=('Minimum number of features to extract per image. '
|
help=('Minimum number of features to extract per image. '
|
||||||
'More features leads to better results but slower '
|
'More features leads to better results but slower '
|
||||||
'execution.'))
|
'execution. Default: %(default)s'))
|
||||||
|
|
||||||
parser.add_argument('--matcher-threshold',
|
parser.add_argument('--matcher-threshold',
|
||||||
metavar='<percent>',
|
metavar='<percent>',
|
||||||
default=2.0,
|
default=2.0,
|
||||||
type=float,
|
type=float,
|
||||||
help=('Ignore matched keypoints if the two images share '
|
help=('Ignore matched keypoints if the two images share '
|
||||||
'less than <float> percent of keypoints'))
|
'less than <float> percent of keypoints. Default:'
|
||||||
|
' $(default)s'))
|
||||||
|
|
||||||
parser.add_argument('--matcher-ratio',
|
parser.add_argument('--matcher-ratio',
|
||||||
metavar='<float>',
|
metavar='<float>',
|
||||||
default=0.6,
|
default=0.6,
|
||||||
type=float,
|
type=float,
|
||||||
help=('Ratio of the distance to the next best matched '
|
help=('Ratio of the distance to the next best matched '
|
||||||
'keypoint'))
|
'keypoint. Default: %(default)s'))
|
||||||
|
|
||||||
parser.add_argument('--matcher-preselect',
|
parser.add_argument('--matcher-neighbors',
|
||||||
type=bool,
|
|
||||||
metavar='',
|
|
||||||
default=False,
|
|
||||||
help=('use GPS exif data, if available, to match each '
|
|
||||||
'image only with its k-nearest neighbors, or all '
|
|
||||||
'images within a certain distance threshold'))
|
|
||||||
|
|
||||||
parser.add_argument('--matcher-useKnn',
|
|
||||||
type=bool,
|
|
||||||
metavar='',
|
|
||||||
default=True,
|
|
||||||
help=('use GPS exif data, if available, to match each '
|
|
||||||
'image only with its k-nearest neighbors, or all '
|
|
||||||
'images within a certain distance threshold'))
|
|
||||||
|
|
||||||
parser.add_argument('--matcher-kDistance',
|
|
||||||
metavar='<integer>',
|
|
||||||
default=20,
|
|
||||||
type=int,
|
type=int,
|
||||||
help='')
|
|
||||||
|
|
||||||
parser.add_argument('--matcher-k',
|
|
||||||
metavar='<integer>',
|
metavar='<integer>',
|
||||||
default=8,
|
default=8,
|
||||||
|
help='Number of nearest images to pre-match based on GPS '
|
||||||
|
'exif data. Set to 0 to skip pre-matching. '
|
||||||
|
'Neighbors works together with Distance parameter, '
|
||||||
|
'set both to 0 to not use pre-matching. OpenSFM '
|
||||||
|
'uses both parameters at the same time, Bundler '
|
||||||
|
'uses only one which has value, prefering the '
|
||||||
|
'Neighbors parameter. Default: %(default)s')
|
||||||
|
|
||||||
|
parser.add_argument('--matcher-distance',
|
||||||
|
metavar='<integer>',
|
||||||
|
default=0,
|
||||||
type=int,
|
type=int,
|
||||||
help='Number of k-nearest images to match '
|
help='Distance threshold in meters to find pre-matching '
|
||||||
'when using OpenSfM')
|
'images based on GPS exif data. Set to 0 to skip '
|
||||||
|
'pre-matching. Default: %(default)s')
|
||||||
|
|
||||||
parser.add_argument('--cmvs-maxImages',
|
parser.add_argument('--cmvs-maxImages',
|
||||||
metavar='<integer>',
|
metavar='<integer>',
|
||||||
default=500,
|
default=500,
|
||||||
type=int,
|
type=int,
|
||||||
help='The maximum number of images per cluster')
|
help='The maximum number of images per cluster. '
|
||||||
|
'Default: %(default)s')
|
||||||
|
|
||||||
parser.add_argument('--pmvs-level',
|
parser.add_argument('--pmvs-level',
|
||||||
metavar='<positive integer>',
|
metavar='<positive integer>',
|
||||||
|
@ -108,32 +101,33 @@ parser.add_argument('--pmvs-level',
|
||||||
help=('The level in the image pyramid that is used '
|
help=('The level in the image pyramid that is used '
|
||||||
'for the computation. see '
|
'for the computation. see '
|
||||||
'http://www.di.ens.fr/pmvs/documentation.html for '
|
'http://www.di.ens.fr/pmvs/documentation.html for '
|
||||||
'more pmvs documentation'))
|
'more pmvs documentation. Default: %(default)s'))
|
||||||
|
|
||||||
parser.add_argument('--pmvs-csize',
|
parser.add_argument('--pmvs-csize',
|
||||||
metavar='< positive integer>',
|
metavar='< positive integer>',
|
||||||
default=2,
|
default=2,
|
||||||
type=int,
|
type=int,
|
||||||
help='Cell size controls the density of reconstructions')
|
help='Cell size controls the density of reconstructions'
|
||||||
|
'Default: %(default)s')
|
||||||
|
|
||||||
parser.add_argument('--pmvs-threshold',
|
parser.add_argument('--pmvs-threshold',
|
||||||
metavar='<float: -1.0 <= x <= 1.0>',
|
metavar='<float: -1.0 <= x <= 1.0>',
|
||||||
default=0.7,
|
default=0.7,
|
||||||
type=float,
|
type=float,
|
||||||
help=('A patch reconstruction is accepted as a success '
|
help=('A patch reconstruction is accepted as a success '
|
||||||
'and kept, if its associcated photometric consistency '
|
'and kept if its associated photometric consistency '
|
||||||
'measure is above this threshold.'))
|
'measure is above this threshold. Default: %(default)s'))
|
||||||
|
|
||||||
parser.add_argument('--pmvs-wsize',
|
parser.add_argument('--pmvs-wsize',
|
||||||
metavar='<positive integer>',
|
metavar='<positive integer>',
|
||||||
default=7,
|
default=7,
|
||||||
type=int,
|
type=int,
|
||||||
help=('pmvs samples wsize x wsize pixel colors from '
|
help='pmvs samples wsize x wsize pixel colors from '
|
||||||
'each image to compute photometric consistency '
|
'each image to compute photometric consistency '
|
||||||
'score. For example, when wsize=7, 7x7=49 pixel '
|
'score. For example, when wsize=7, 7x7=49 pixel '
|
||||||
'colors are sampled in each image. Increasing the '
|
'colors are sampled in each image. Increasing the '
|
||||||
'value leads to more stable reconstructions, but '
|
'value leads to more stable reconstructions, but '
|
||||||
'the program becomes slower.'))
|
'the program becomes slower. Default: %(default)s')
|
||||||
|
|
||||||
parser.add_argument('--pmvs-minImageNum',
|
parser.add_argument('--pmvs-minImageNum',
|
||||||
metavar='<positive integer>',
|
metavar='<positive integer>',
|
||||||
|
@ -141,20 +135,21 @@ parser.add_argument('--pmvs-minImageNum',
|
||||||
type=int,
|
type=int,
|
||||||
help=('Each 3D point must be visible in at least '
|
help=('Each 3D point must be visible in at least '
|
||||||
'minImageNum images for being reconstructed. 3 is '
|
'minImageNum images for being reconstructed. 3 is '
|
||||||
'suggested in general.'))
|
'suggested in general. Default: %(default)s'))
|
||||||
|
|
||||||
parser.add_argument('--pmvs-num-cores',
|
parser.add_argument('--pmvs-num-cores',
|
||||||
metavar='<positive integer>',
|
metavar='<positive integer>',
|
||||||
default=1,
|
default=1,
|
||||||
type=int,
|
type=int,
|
||||||
help=('The maximum number of cores to use in dense '
|
help=('The maximum number of cores to use in dense '
|
||||||
'reconstruction.'))
|
'reconstruction. Default: %(default)s'))
|
||||||
|
|
||||||
parser.add_argument('--odm_meshing-maxVertexCount',
|
parser.add_argument('--odm_meshing-maxVertexCount',
|
||||||
metavar='<positive integer>',
|
metavar='<positive integer>',
|
||||||
default=100000,
|
default=100000,
|
||||||
type=int,
|
type=int,
|
||||||
help='The maximum vertex count of the output mesh')
|
help=('The maximum vertex count of the output mesh '
|
||||||
|
'Default: %(default)s'))
|
||||||
|
|
||||||
parser.add_argument('--odm_meshing-octreeDepth',
|
parser.add_argument('--odm_meshing-octreeDepth',
|
||||||
metavar='<positive integer>',
|
metavar='<positive integer>',
|
||||||
|
@ -162,14 +157,14 @@ parser.add_argument('--odm_meshing-octreeDepth',
|
||||||
type=int,
|
type=int,
|
||||||
help=('Oct-tree depth used in the mesh reconstruction, '
|
help=('Oct-tree depth used in the mesh reconstruction, '
|
||||||
'increase to get more vertices, recommended '
|
'increase to get more vertices, recommended '
|
||||||
'values are 8-12'))
|
'values are 8-12. Default: %(default)s'))
|
||||||
|
|
||||||
parser.add_argument('--odm_meshing-samplesPerNode',
|
parser.add_argument('--odm_meshing-samplesPerNode',
|
||||||
metavar='<float >= 1.0>',
|
metavar='<float >= 1.0>',
|
||||||
default=1,
|
default=1.0,
|
||||||
type=float,
|
type=float,
|
||||||
help=('Number of points per octree node, recommended '
|
help=('Number of points per octree node, recommended '
|
||||||
'value: 1.0'))
|
'and default value: %(default)s'))
|
||||||
|
|
||||||
parser.add_argument('--odm_meshing-solverDivide',
|
parser.add_argument('--odm_meshing-solverDivide',
|
||||||
metavar='<positive integer>',
|
metavar='<positive integer>',
|
||||||
|
@ -178,44 +173,48 @@ parser.add_argument('--odm_meshing-solverDivide',
|
||||||
help=('Oct-tree depth at which the Laplacian equation '
|
help=('Oct-tree depth at which the Laplacian equation '
|
||||||
'is solved in the surface reconstruction step. '
|
'is solved in the surface reconstruction step. '
|
||||||
'Increasing this value increases computation '
|
'Increasing this value increases computation '
|
||||||
'times slightly but helps reduce memory usage.'))
|
'times slightly but helps reduce memory usage. '
|
||||||
|
'Default: %(default)s'))
|
||||||
|
|
||||||
parser.add_argument('--odm_texturing-textureResolution',
|
parser.add_argument('--odm_texturing-textureResolution',
|
||||||
metavar='<positive integer>',
|
metavar='<positive integer>',
|
||||||
default=4096,
|
default=4096,
|
||||||
type=int,
|
type=int,
|
||||||
help=('The resolution of the output textures. Must be '
|
help=('The resolution of the output textures. Must be '
|
||||||
'greater than textureWithSize.'))
|
'greater than textureWithSize. Default: %(default)s'))
|
||||||
|
|
||||||
parser.add_argument('--odm_texturing-textureWithSize',
|
parser.add_argument('--odm_texturing-textureWithSize',
|
||||||
metavar='<positive integer>',
|
metavar='<positive integer>',
|
||||||
default=3600,
|
default=3600,
|
||||||
type=int,
|
type=int,
|
||||||
help=('The resolution to rescale the images performing '
|
help=('The resolution to rescale the images performing '
|
||||||
'the texturing.'))
|
'the texturing. Default: %(default)s'))
|
||||||
|
|
||||||
parser.add_argument('--odm_georeferencing-gcpFile',
|
parser.add_argument('--odm_georeferencing-gcpFile',
|
||||||
metavar='<path string>',
|
metavar='<path string>',
|
||||||
default='gcp_list.txt',
|
default='gcp_list.txt',
|
||||||
help=('path to the file containing the ground control '
|
help=('path to the file containing the ground control '
|
||||||
'points used for georeferencing.The file needs to '
|
'points used for georeferencing. Default: '
|
||||||
|
'%(default)s. The file needs to '
|
||||||
'be on the following line format: \neasting '
|
'be on the following line format: \neasting '
|
||||||
'northing height pixelrow pixelcol imagename'))
|
'northing height pixelrow pixelcol imagename'))
|
||||||
|
|
||||||
parser.add_argument('--odm_georeferencing-useGcp',
|
parser.add_argument('--odm_georeferencing-useGcp',
|
||||||
type = bool,
|
action = 'store_true',
|
||||||
default = False,
|
default = False,
|
||||||
help = 'set to true for enabling GCPs from the file above')
|
help = 'Enabling GCPs from the file above. The GCP file '
|
||||||
|
'is not used by default.')
|
||||||
|
|
||||||
parser.add_argument('--odm_orthophoto-resolution',
|
parser.add_argument('--odm_orthophoto-resolution',
|
||||||
metavar='<float > 0.0>',
|
metavar='<float > 0.0>',
|
||||||
default=20.0,
|
default=20.0,
|
||||||
type=float,
|
type=float,
|
||||||
help=('Orthophoto ground resolution in pixels/meter'))
|
help=('Orthophoto ground resolution in pixels/meter'
|
||||||
|
'Default: %(default)s'))
|
||||||
|
|
||||||
parser.add_argument('--zip-results',
|
parser.add_argument('--zip-results',
|
||||||
action='store_true',
|
action='store_true',
|
||||||
default=False,
|
default=False,
|
||||||
help='compress the results using gunzip')
|
help='compress the results using gunzip')
|
||||||
|
|
||||||
args = vars(parser.parse_args())
|
args = vars(parser.parse_args())
|
||||||
|
|
|
@ -38,7 +38,8 @@ class ODMApp(ecto.BlackBox):
|
||||||
feature_process_size=p.args['resize_to'],
|
feature_process_size=p.args['resize_to'],
|
||||||
feature_min_frames=p.args['min_num_features'],
|
feature_min_frames=p.args['min_num_features'],
|
||||||
processes=context.num_cores,
|
processes=context.num_cores,
|
||||||
matching_gps_neighbors=p.args['matcher_k']),
|
matching_gps_neighbors=p.args['matcher_neighbors'],
|
||||||
|
matching_gps_distance=p.args['matcher_distance']),
|
||||||
'cmvs': ODMCmvsCell(max_images=p.args['cmvs_maxImages']),
|
'cmvs': ODMCmvsCell(max_images=p.args['cmvs_maxImages']),
|
||||||
'pmvs': ODMPmvsCell(level=p.args['pmvs_level'],
|
'pmvs': ODMPmvsCell(level=p.args['pmvs_level'],
|
||||||
csize=p.args['pmvs_csize'],
|
csize=p.args['pmvs_csize'],
|
||||||
|
@ -118,4 +119,4 @@ class ODMApp(ecto.BlackBox):
|
||||||
self.args[:] >> self.orthophoto['args'],
|
self.args[:] >> self.orthophoto['args'],
|
||||||
self.georeferencing['reconstruction'] >> self.orthophoto['reconstruction'] ]
|
self.georeferencing['reconstruction'] >> self.orthophoto['reconstruction'] ]
|
||||||
|
|
||||||
return connections
|
return connections
|
||||||
|
|
|
@ -8,10 +8,11 @@ from opendm import context
|
||||||
class ODMOpenSfMCell(ecto.Cell):
|
class ODMOpenSfMCell(ecto.Cell):
|
||||||
def declare_params(self, params):
|
def declare_params(self, params):
|
||||||
params.declare("use_exif_size", "The application arguments.", False)
|
params.declare("use_exif_size", "The application arguments.", False)
|
||||||
params.declare("feature_process_size", "The application arguments.", False)
|
params.declare("feature_process_size", "The application arguments.", 2400)
|
||||||
params.declare("feature_min_frames", "The application arguments.", 0)
|
params.declare("feature_min_frames", "The application arguments.", 4000)
|
||||||
params.declare("processes", "The application arguments.", 0)
|
params.declare("processes", "The application arguments.", context.num_cores)
|
||||||
params.declare("matching_gps_neighbors", "The application arguments.", 0)
|
params.declare("matching_gps_neighbors", "The application arguments.", 8)
|
||||||
|
params.declare("matching_gps_distance", "The application arguments.", 0)
|
||||||
|
|
||||||
def declare_io(self, params, inputs, outputs):
|
def declare_io(self, params, inputs, outputs):
|
||||||
inputs.declare("tree", "Struct with paths", [])
|
inputs.declare("tree", "Struct with paths", [])
|
||||||
|
@ -59,6 +60,9 @@ class ODMOpenSfMCell(ecto.Cell):
|
||||||
"matching_gps_neighbors: %s" % self.params.matching_gps_neighbors
|
"matching_gps_neighbors: %s" % self.params.matching_gps_neighbors
|
||||||
]
|
]
|
||||||
|
|
||||||
|
if args['matcher_distance']>0:
|
||||||
|
config.append("matching_gps_distance: %s" % self.params.matching_gps_distance)
|
||||||
|
|
||||||
# write config file
|
# write config file
|
||||||
config_filename = io.join_paths(tree.opensfm, 'config.yaml')
|
config_filename = io.join_paths(tree.opensfm, 'config.yaml')
|
||||||
with open(config_filename, 'w') as fout:
|
with open(config_filename, 'w') as fout:
|
||||||
|
@ -93,4 +97,4 @@ class ODMOpenSfMCell(ecto.Cell):
|
||||||
log.ODM_WARNING('Found a valid CMVS file in: %s' % tree.pmvs_visdat)
|
log.ODM_WARNING('Found a valid CMVS file in: %s' % tree.pmvs_visdat)
|
||||||
|
|
||||||
log.ODM_INFO('Running OMD OpenSfm Cell - Finished')
|
log.ODM_INFO('Running OMD OpenSfm Cell - Finished')
|
||||||
return ecto.OK if args['end_with'] != 'opensfm' else ecto.QUIT
|
return ecto.OK if args['end_with'] != 'opensfm' else ecto.QUIT
|
||||||
|
|
Ładowanie…
Reference in New Issue