def run_system(config, make, register, refine, integrate, debug_mode): if not make and \ not register and \ not refine and \ not integrate: parser.print_help(sys.stderr) sys.exit(1) if config is not None: with open(config) as json_file: config = json.load(json_file) initialize_config(config) check_folder_structure(config["path_dataset"]) assert config is not None if debug_mode: config['debug_mode'] = True else: config['debug_mode'] = False print("====================================") print("Configuration") print("====================================") for key, val in config.items(): print("%40s : %s" % (key, str(val))) times = [0, 0, 0, 0] if make: start_time = time.time() import make_fragments make_fragments.run(config) times[0] = time.time() - start_time if register: start_time = time.time() import register_fragments register_fragments.run(config) times[1] = time.time() - start_time if refine: start_time = time.time() import refine_registration refine_registration.run(config) times[2] = time.time() - start_time if integrate: start_time = time.time() import integrate_scene mesh = integrate_scene.run(config) times[3] = time.time() - start_time print("====================================") print("Elapsed time (in h:m:s)") print("====================================") print("- Making fragments %s" % datetime.timedelta(seconds=times[0])) print("- Register fragments %s" % datetime.timedelta(seconds=times[1])) print("- Refine registration %s" % datetime.timedelta(seconds=times[2])) print("- Integrate frames %s" % datetime.timedelta(seconds=times[3])) print("- Total %s" % datetime.timedelta(seconds=sum(times))) sys.stdout.flush() return mesh
for key, val in config.items(): print("%40s : %s" % (key, str(val))) # 3D重建的主体内容 times = [0, 0, 0, 0] start_time = time.time() # 1. 生成场景片段 make_fragments.run(config) times[0] = time.time() - start_time start_time = time.time() # 2. 配准场景片段 register_fragments.run(config) times[1] = time.time() - start_time start_time = time.time() # 3. 改善配准结果 refine_registration.run(config) times[2] = time.time() - start_time start_time = time.time() # 4. 整合片段并重建场景 integrate_scene.run(config) times[3] = time.time() - start_time # 打印每部分的耗时 print("====================================") print("Elapsed time (in h:m:s)") print("====================================") print("- Making fragments %s" % datetime.timedelta(seconds=times[0])) print("- Register fragments %s" % datetime.timedelta(seconds=times[1])) print("- Refine registration %s" % datetime.timedelta(seconds=times[2])) print("- Integrate frames %s" % datetime.timedelta(seconds=times[3])) print("- Total %s" % datetime.timedelta(seconds=sum(times)))
def main_register_capture(dirName): ''' # need to tweak config file with open("config/kinect_config.json", "r") as json_file: config = json.load(json_file) initialize_config(config) check_folder_structure(config["path_dataset"]) assert config is not None tmp = config["path_dataset"] config["path_dataset"] = dirName ''' updateConfig(dirName) # save changes to file #with open("config/kinect_config.json", "w+") as json_file: # json_file.write(json.dumps(config)) with open("config/kinect_config.json", "r") as json_file: config = json.load(json_file) # will change config['debug_mode'] = False print("Updated .json with {}".format(config["path_dataset"])) print("====================================") print("Configuration") print("====================================") times = [0, 0, 0, 0] print('\nMAKING FRAGMENTS') start_time = time.time() import make_fragments make_fragments.run(config) times[0] = time.time() - start_time print('MADE FRAGMENTS') print('\nREGISTERING FRAGMENTS') start_time = time.time() import register_fragments register_fragments.run(config) times[1] = time.time() - start_time print('REGISTERED FRAGMENTS') print('\nREFINING REGISTRATION') start_time = time.time() import refine_registration refine_registration.run(config) times[2] = time.time() - start_time print('REFINED REGISTRATION') print('\nINTEGRATING SCENE') start_time = time.time() import integrate_scene integrate_scene.run(config) times[3] = time.time() - start_time print('INTEGRATED SCENE') print("====================================") print("Elapsed time (in h:m:s)") print("====================================") print("- Making fragments |\t%s" % datetime.timedelta(seconds=times[0])) print("- Register fragments |\t%s" % datetime.timedelta(seconds=times[1])) print("- Refine registration |\t%s" % datetime.timedelta(seconds=times[2])) print("- Integrate frames |\t%s" % datetime.timedelta(seconds=times[3])) print("-\n- Total |\t%s" % datetime.timedelta(seconds=sum(times))) sys.stdout.flush()