AKAZE features, BRUTEFORCE matcher logic, geo.txt fix

pull/1362/head
Piero Toffanin 2021-11-15 12:09:21 -05:00
rodzic f4985026de
commit e1a326f936
6 zmienionych plików z 35 dodań i 15 usunięć

Wyświetl plik

@ -151,7 +151,7 @@ def config(argv=None, parser=None):
metavar='<string>', metavar='<string>',
action=StoreValue, action=StoreValue,
default='flann', default='flann',
choices=['bow', 'bruteforce'. 'flann'], choices=['bow', 'bruteforce', 'flann'],
help=('Matcher algorithm, Fast Library for Approximate Nearest Neighbors or Bag of Words. FLANN is slower, but more stable. BOW is faster, but can sometimes miss valid matches. BRUTEFORCE is very slow but robust.' help=('Matcher algorithm, Fast Library for Approximate Nearest Neighbors or Bag of Words. FLANN is slower, but more stable. BOW is faster, but can sometimes miss valid matches. BRUTEFORCE is very slow but robust.'
'Can be one of: %(choices)s. Default: ' 'Can be one of: %(choices)s. Default: '
'%(default)s')) '%(default)s'))

Wyświetl plik

@ -117,9 +117,6 @@ class OSFMContext:
except Exception as e: except Exception as e:
log.ODM_WARNING("Cannot set camera_models_overrides.json: %s" % str(e)) log.ODM_WARNING("Cannot set camera_models_overrides.json: %s" % str(e))
use_bow = args.matcher_type == "bow"
feature_type = "SIFT"
# GPSDOP override if we have GPS accuracy information (such as RTK) # GPSDOP override if we have GPS accuracy information (such as RTK)
if 'gps_accuracy_is_set' in args: if 'gps_accuracy_is_set' in args:
log.ODM_INFO("Forcing GPS DOP to %s for all images" % args.gps_accuracy) log.ODM_INFO("Forcing GPS DOP to %s for all images" % args.gps_accuracy)
@ -208,20 +205,33 @@ class OSFMContext:
if args.camera_lens != 'auto': if args.camera_lens != 'auto':
config.append("camera_projection_type: %s" % args.camera_lens.upper()) config.append("camera_projection_type: %s" % args.camera_lens.upper())
if not has_gps: matcher_type = args.matcher_type
log.ODM_INFO("No GPS information, using BOW matching")
use_bow = True
feature_type = args.feature_type.upper() feature_type = args.feature_type.upper()
if use_bow: osfm_matchers = {
config.append("matcher_type: WORDS") "bow": "WORDS",
"flann": "FLANN",
"bruteforce": "BRUTEFORCE"
}
# Cannot use SIFT with BOW if not has_gps:
if feature_type == "SIFT": log.ODM_INFO("No GPS information, using BOW matching")
matcher_type = "bow"
if matcher_type == "bow":
# Cannot use anything other than HAHOG with BOW
if feature_type != "HAHOG":
log.ODM_WARNING("Using BOW matching, will use HAHOG feature type, not SIFT") log.ODM_WARNING("Using BOW matching, will use HAHOG feature type, not SIFT")
feature_type = "HAHOG" feature_type = "HAHOG"
if feature_type == "AKAZE" or feature_type == "ORB":
# Cannot use anything other than BRUTEFORCE with AKAZE/ORB
if matcher_type != "bruteforce":
log.ODM_WARNING("Using BRUTEFORCE matching (needed since %s is selected)" % feature_type)
matcher_type = "bruteforce"
config.append("matcher_type: %s" % osfm_matchers[matcher_type])
# GPU acceleration? # GPU acceleration?
if has_gpus() and feature_type == "SIFT" and (not 'min_num_features_is_set' in args): if has_gpus() and feature_type == "SIFT" and (not 'min_num_features_is_set' in args):
log.ODM_INFO("Using GPU for extracting SIFT features") log.ODM_INFO("Using GPU for extracting SIFT features")

Wyświetl plik

@ -341,6 +341,10 @@ class Task:
if os.path.exists(self.path("gcp_list.txt")): if os.path.exists(self.path("gcp_list.txt")):
images.append(self.path("gcp_list.txt")) images.append(self.path("gcp_list.txt"))
# Add GEO (optional)
if os.path.exists(self.path("geo.txt")):
images.append(self.path("geo.txt"))
# Add seed file # Add seed file
images.append(seed_file) images.append(seed_file)

Wyświetl plik

@ -5,6 +5,7 @@ import numpy as np
from opendm import get_image_size from opendm import get_image_size
from opendm import location from opendm import location
from opendm.gcp import GCPFile from opendm.gcp import GCPFile
from opendm.geo import GeoFile
from pyproj import CRS from pyproj import CRS
import xmltodict as x2d import xmltodict as x2d
from six import string_types from six import string_types
@ -25,7 +26,6 @@ class ODM_Reconstruction(object):
self.photos = photos self.photos = photos
self.georef = None self.georef = None
self.gcp = None self.gcp = None
self.geo_file = None
self.multi_camera = self.detect_multi_camera() self.multi_camera = self.detect_multi_camera()
def detect_multi_camera(self): def detect_multi_camera(self):

Wyświetl plik

@ -115,7 +115,7 @@ class ODMLoadDatasetStage(types.ODM_Stage):
dataset_list.write(photos[-1].filename + '\n') dataset_list.write(photos[-1].filename + '\n')
# Check if a geo file is available # Check if a geo file is available
if tree.odm_geo_file is not None and os.path.exists(tree.odm_geo_file): if tree.odm_geo_file is not None and os.path.isfile(tree.odm_geo_file):
log.ODM_INFO("Found image geolocation file") log.ODM_INFO("Found image geolocation file")
gf = GeoFile(tree.odm_geo_file) gf = GeoFile(tree.odm_geo_file)
updated = 0 updated = 0

Wyświetl plik

@ -90,6 +90,12 @@ class ODMSplitStage(types.ODM_Stage):
else: else:
log.ODM_INFO("No GCP will be copied for %s, not enough images in the submodel are referenced by the GCP" % sp_octx.name()) log.ODM_INFO("No GCP will be copied for %s, not enough images in the submodel are referenced by the GCP" % sp_octx.name())
# Copy GEO file if needed (one for each submodel project directory)
if tree.odm_geo_file is not None and os.path.isfile(tree.odm_geo_file):
geo_dst_path = os.path.abspath(sp_octx.path("..", "geo.txt"))
io.copy(tree.odm_geo_file, geo_dst_path)
log.ODM_INFO("Copied GEO file to %s" % geo_dst_path)
# Reconstruct each submodel # Reconstruct each submodel
log.ODM_INFO("Dataset has been split into %s submodels. Reconstructing each submodel..." % len(submodel_paths)) log.ODM_INFO("Dataset has been split into %s submodels. Reconstructing each submodel..." % len(submodel_paths))
self.update_progress(25) self.update_progress(25)