Merge pull request #17 from dakotabenjamin/cmake-changes

Update matcher args, opensfm url, and ccd_defs_check
pull/249/head
Edgar Riba 2016-02-02 18:04:20 +01:00
commit d985e94ad5
6 zmienionych plików z 90 dodań i 60 usunięć

Wyświetl plik

@ -8,8 +8,8 @@ ExternalProject_Add(${_proj_name}
STAMP_DIR ${_SB_BINARY_DIR}/stamp
#--Download step--------------
DOWNLOAD_DIR ${SB_DOWNLOAD_DIR}
URL https://github.com/mapillary/OpenSfM/archive/odm-2.zip
URL_MD5 2D56E04D7130E7A9D266BDBAC0539C47
URL https://github.com/mapillary/OpenSfM/archive/a4b07056aec1184692c1432fbdd1074710aec32b.zip
URL_MD5 42B2B1994C3309BBF4525C8CC1F6F741
#--Update/Patch step----------
UPDATE_COMMAND ""
#--Configure step-------------

25
ccd_defs_check.py 100755
Wyświetl plik

@ -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)

Wyświetl plik

@ -10,13 +10,14 @@
exec 1>&2
echo "RUNNING PRE-COMMIT"
EXIT_CODE=0
# Get list of files about to be committed
if git diff --cached --name-only --diff-filter=ACM | grep 'ccd_defs.json'; then
echo "We changed ccd_defs.json"
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
# non-zero exit fails the commit
exit 0
exit $EXIT_CODE

Wyświetl plik

@ -50,56 +50,49 @@ parser.add_argument('--min-num-features',
type=int,
help=('Minimum number of features to extract per image. '
'More features leads to better results but slower '
'execution.'))
'execution. Default: %(default)s'))
parser.add_argument('--matcher-threshold',
metavar='<percent>',
default=2.0,
type=float,
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',
metavar='<float>',
default=0.6,
type=float,
help=('Ratio of the distance to the next best matched '
'keypoint'))
'keypoint. Default: %(default)s'))
parser.add_argument('--matcher-preselect',
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,
parser.add_argument('--matcher-neighbors',
type=int,
help='')
parser.add_argument('--matcher-k',
metavar='<integer>',
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,
help='Number of k-nearest images to match '
'when using OpenSfM')
help='Distance threshold in meters to find pre-matching '
'images based on GPS exif data. Set to 0 to skip '
'pre-matching. Default: %(default)s')
parser.add_argument('--cmvs-maxImages',
metavar='<integer>',
default=500,
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',
metavar='<positive integer>',
@ -108,32 +101,33 @@ parser.add_argument('--pmvs-level',
help=('The level in the image pyramid that is used '
'for the computation. see '
'http://www.di.ens.fr/pmvs/documentation.html for '
'more pmvs documentation'))
'more pmvs documentation. Default: %(default)s'))
parser.add_argument('--pmvs-csize',
metavar='< positive integer>',
default=2,
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',
metavar='<float: -1.0 <= x <= 1.0>',
default=0.7,
type=float,
help=('A patch reconstruction is accepted as a success '
'and kept, if its associcated photometric consistency '
'measure is above this threshold.'))
'and kept if its associated photometric consistency '
'measure is above this threshold. Default: %(default)s'))
parser.add_argument('--pmvs-wsize',
metavar='<positive integer>',
default=7,
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 '
'score. For example, when wsize=7, 7x7=49 pixel '
'colors are sampled in each image. Increasing the '
'value leads to more stable reconstructions, but '
'the program becomes slower.'))
'the program becomes slower. Default: %(default)s')
parser.add_argument('--pmvs-minImageNum',
metavar='<positive integer>',
@ -141,20 +135,21 @@ parser.add_argument('--pmvs-minImageNum',
type=int,
help=('Each 3D point must be visible in at least '
'minImageNum images for being reconstructed. 3 is '
'suggested in general.'))
'suggested in general. Default: %(default)s'))
parser.add_argument('--pmvs-num-cores',
metavar='<positive integer>',
default=1,
type=int,
help=('The maximum number of cores to use in dense '
'reconstruction.'))
'reconstruction. Default: %(default)s'))
parser.add_argument('--odm_meshing-maxVertexCount',
metavar='<positive integer>',
default=100000,
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',
metavar='<positive integer>',
@ -162,14 +157,14 @@ parser.add_argument('--odm_meshing-octreeDepth',
type=int,
help=('Oct-tree depth used in the mesh reconstruction, '
'increase to get more vertices, recommended '
'values are 8-12'))
'values are 8-12. Default: %(default)s'))
parser.add_argument('--odm_meshing-samplesPerNode',
metavar='<float >= 1.0>',
default=1,
default=1.0,
type=float,
help=('Number of points per octree node, recommended '
'value: 1.0'))
'and default value: %(default)s'))
parser.add_argument('--odm_meshing-solverDivide',
metavar='<positive integer>',
@ -178,44 +173,48 @@ parser.add_argument('--odm_meshing-solverDivide',
help=('Oct-tree depth at which the Laplacian equation '
'is solved in the surface reconstruction step. '
'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',
metavar='<positive integer>',
default=4096,
type=int,
help=('The resolution of the output textures. Must be '
'greater than textureWithSize.'))
'greater than textureWithSize. Default: %(default)s'))
parser.add_argument('--odm_texturing-textureWithSize',
metavar='<positive integer>',
default=3600,
type=int,
help=('The resolution to rescale the images performing '
'the texturing.'))
'the texturing. Default: %(default)s'))
parser.add_argument('--odm_georeferencing-gcpFile',
metavar='<path string>',
default='gcp_list.txt',
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 '
'northing height pixelrow pixelcol imagename'))
parser.add_argument('--odm_georeferencing-useGcp',
type = bool,
action = 'store_true',
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',
metavar='<float > 0.0>',
default=20.0,
type=float,
help=('Orthophoto ground resolution in pixels/meter'))
help=('Orthophoto ground resolution in pixels/meter'
'Default: %(default)s'))
parser.add_argument('--zip-results',
action='store_true',
default=False,
help='compress the results using gunzip')
args = vars(parser.parse_args())
args = vars(parser.parse_args())

Wyświetl plik

@ -38,7 +38,8 @@ class ODMApp(ecto.BlackBox):
feature_process_size=p.args['resize_to'],
feature_min_frames=p.args['min_num_features'],
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']),
'pmvs': ODMPmvsCell(level=p.args['pmvs_level'],
csize=p.args['pmvs_csize'],
@ -118,4 +119,4 @@ class ODMApp(ecto.BlackBox):
self.args[:] >> self.orthophoto['args'],
self.georeferencing['reconstruction'] >> self.orthophoto['reconstruction'] ]
return connections
return connections

Wyświetl plik

@ -8,10 +8,11 @@ from opendm import context
class ODMOpenSfMCell(ecto.Cell):
def declare_params(self, params):
params.declare("use_exif_size", "The application arguments.", False)
params.declare("feature_process_size", "The application arguments.", False)
params.declare("feature_min_frames", "The application arguments.", 0)
params.declare("processes", "The application arguments.", 0)
params.declare("matching_gps_neighbors", "The application arguments.", 0)
params.declare("feature_process_size", "The application arguments.", 2400)
params.declare("feature_min_frames", "The application arguments.", 4000)
params.declare("processes", "The application arguments.", context.num_cores)
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):
inputs.declare("tree", "Struct with paths", [])
@ -59,6 +60,9 @@ class ODMOpenSfMCell(ecto.Cell):
"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
config_filename = io.join_paths(tree.opensfm, 'config.yaml')
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_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