Plug rs_correct

pull/1467/head
Piero Toffanin 2022-06-15 08:40:34 -04:00
rodzic f3f0d21b2a
commit e80b89a055
6 zmienionych plików z 24 dodań i 5 usunięć

Wyświetl plik

@ -119,7 +119,7 @@ SETUP_EXTERNAL_PROJECT(GFlags ${ODM_GFlags_Version} ${ODM_BUILD_GFlags})
# ---------------------------------------------------------------------------------------------
# Ceres Solver
#
set(ODM_Ceres_Version 1.10.0)
set(ODM_Ceres_Version 2.0.0)
option(ODM_BUILD_Ceres "Force to build Ceres library" OFF)
SETUP_EXTERNAL_PROJECT(Ceres ${ODM_Ceres_Version} ${ODM_BUILD_Ceres})

Wyświetl plik

@ -40,15 +40,19 @@ class OSFMContext:
return io.file_exists(tracks_file) and io.file_exists(reconstruction_file)
def reconstruct(self, rerun=False):
def create_tracks(self, rerun=False):
tracks_file = os.path.join(self.opensfm_project_path, 'tracks.csv')
reconstruction_file = os.path.join(self.opensfm_project_path, 'reconstruction.json')
rs_file = self.path('rs_done.txt')
if not io.file_exists(tracks_file) or rerun:
self.run('create_tracks')
else:
log.ODM_WARNING('Found a valid OpenSfM tracks file in: %s' % tracks_file)
def reconstruct(self, rolling_shutter_correct=False, rerun=False):
# TODO: FIX calls from split-merge
reconstruction_file = os.path.join(self.opensfm_project_path, 'reconstruction.json')
if not io.file_exists(reconstruction_file) or rerun:
self.run('reconstruct')
self.check_merge_partial_reconstructions()
@ -64,6 +68,15 @@ class OSFMContext:
"You could also try to increase the --min-num-features parameter."
"The program will now exit.")
if rolling_shutter_correct:
rs_file = self.path('rs_done.txt')
if not io.file_exists(rs_file) or rerun:
self.run('rs_correct --output reconstruction.json --output-tracks tracks.csv')
self.touch(rs_file)
else:
log.ODM_WARNING("Rolling shutter correction already applied")
def check_merge_partial_reconstructions(self):
if self.reconstructed():
data = DataSet(self.opensfm_project_path)

Wyświetl plik

@ -446,6 +446,7 @@ class ReconstructionTask(Task):
log.ODM_INFO("Local Reconstruction %s" % octx.name())
log.ODM_INFO("==================================")
octx.feature_matching(self.params['rerun'])
octx.create_tracks(self.params['rerun'])
octx.reconstruct(self.params['rerun'])
def process_remote(self, done):

Wyświetl plik

@ -11,6 +11,8 @@ RS_DATABASE = {
'dji fc330': 33, # Phantom 4
'dji fc6310': 33, # Phantom 4 Professional
'dji fc7203': 20, # Mavic Mini v1
'dji fc350': 30, # Inspire 1
'gopro hero4 black': 30 # GoPro Hero 4 Black

Wyświetl plik

@ -34,7 +34,8 @@ class ODMOpenSfMStage(types.ODM_Stage):
self.update_progress(20)
octx.feature_matching(self.rerun())
self.update_progress(30)
octx.reconstruct(self.rerun())
octx.create_tracks(self.rerun())
octx.reconstruct(args.rolling_shutter, self.rerun())
octx.extract_cameras(tree.path("cameras.json"), self.rerun())
self.update_progress(70)

Wyświetl plik

@ -103,7 +103,9 @@ class ODMSplitStage(types.ODM_Stage):
if local_workflow:
for sp in submodel_paths:
log.ODM_INFO("Reconstructing %s" % sp)
OSFMContext(sp).reconstruct(self.rerun())
local_sp_octx = OSFMContext(sp)
local_sp_octx.create_tracks(self.rerun())
local_sp_octx.reconstruct(self.rerun())
else:
lre = LocalRemoteExecutor(args.sm_cluster, self.rerun())
lre.set_projects([os.path.abspath(os.path.join(p, "..")) for p in submodel_paths])