@@ -494,16 +494,6 @@ def onMappingOutput(output):
494
494
print (f"ERROR: { e } " , flush = True )
495
495
raise e
496
496
497
- def copy_input_to_tmp_safe (input_dir , tmp_input ):
498
- # also works if tmp dir is inside the input directory
499
- os .makedirs (tmp_input , exist_ok = True )
500
- shutil .rmtree (tmp_input )
501
- os .makedirs (tmp_input )
502
- for f in os .listdir (input_dir ):
503
- full_fn = os .path .join (input_dir , f )
504
- if not os .path .isdir (full_fn ): shutil .copy (full_fn , tmp_input )
505
- elif f .startswith ("frames" ): shutil .copytree (full_fn , f"{ tmp_input } /{ f } " , dirs_exist_ok = True )
506
-
507
497
def detect_device_preset (input_dir ):
508
498
cameras = None
509
499
calibrationJson = f"{ input_dir } /calibration.json"
@@ -549,8 +539,6 @@ def detect_device_preset(input_dir):
549
539
os .makedirs (f"{ args .output } /images" , exist_ok = True )
550
540
551
541
tmp_dir = tempfile .mkdtemp ()
552
- tmp_input = tempfile .mkdtemp ()
553
- copy_input_to_tmp_safe (args .input , tmp_input )
554
542
555
543
device_preset , cameras = detect_device_preset (args .input )
556
544
@@ -608,13 +596,10 @@ def detect_device_preset(input_dir):
608
596
visArgs .showCameraModel = False
609
597
visualizer = Visualizer (visArgs )
610
598
611
- with open (tmp_input + "/vio_config.yaml" , 'wt' ) as f :
612
- base_params = 'parameterSets: %s' % json .dumps (parameter_sets )
613
- f .write (base_params + '\n ' )
614
- print (base_params )
615
-
599
+ config ['parameterSets' ] = parameter_sets
616
600
print (config )
617
- replay = spectacularAI .Replay (tmp_input , mapperCallback = onMappingOutput , configuration = config )
601
+
602
+ replay = spectacularAI .Replay (args .input , mapperCallback = onMappingOutput , configuration = config , ignoreFolderConfiguration = True )
618
603
replay .setOutputCallback (onVioOutput )
619
604
620
605
try :
@@ -628,19 +613,13 @@ def detect_device_preset(input_dir):
628
613
print (f"Something went wrong! { e } " , flush = True )
629
614
raise e
630
615
631
- # Make sure replay is closed, so that we can delete the tmp_input directory.
632
616
replay = None
633
617
634
618
try :
635
619
shutil .rmtree (tmp_dir )
636
620
except :
637
621
print (f"Failed to clean temporary directory, you can delete these files manually, they are no longer required: { tmp_dir } " , flush = True )
638
622
639
- try :
640
- shutil .rmtree (tmp_input )
641
- except :
642
- print (f"Failed to clean temporary directory, you can delete these files manually, they are no longer required: { tmp_input } " , flush = True )
643
-
644
623
if not finalMapWritten :
645
624
print ('Mapping failed: no output generated' )
646
625
exit (1 )
0 commit comments