time1 = time.time() input_dir = sys.argv[1] output_dir = sys.argv[2] use_focal = 0 if argc >= 4: use_focal = 1 focal = sys.argv[3] use_pair_list = 0 if argc >= 5: use_pair_list = 1 pair_list_file = os.path.join(input_dir, sys.argv[4]) print input_dir print output_dir ZQ_utils.mkdir_ine(output_dir) print 'Copy data to work directionary' ZQ_utils.cleardir_ine(WORK_DIR) ZQ_utils.mkdir_ine(WORK_DIR) ZQ_utils.copy_jpg_fold_to_fold(input_dir, WORK_DIR) print 'Intrinsics analysis' cmdline = ZQ_utils.aug_path( os.path.join(OPENMVG_BIN, 'openMVG_main_SfMInit_ImageListing.exe') ) + ' -i ' + ZQ_utils.aug_path(input_dir) + ' -o ' + ZQ_utils.aug_path( matches_dir) + ' -d ' + ZQ_utils.aug_path( camera_file_params) + ' -g 0 -c 2' if use_focal: cmdline = cmdline + ' -f ' + focal print cmdline
WORK_DIR = os.path.join(os.getcwd(), 'openMVGopenMVS\\tmp') ## RUN focal = 1000 pair_list_file = 'pair_list.txt' argc = len(sys.argv) if argc != 3 and argc != 4 and argc != 5: print 'input_dir output_dir [focal] [pair_list_file]' input_dir = sys.argv[1] output_dir = sys.argv[2] time1 = time.time() print input_dir print output_dir ZQ_utils.mkdir_ine(output_dir) print 'Copy data to work directionary' ZQ_utils.cleardir_ine(WORK_DIR) ZQ_utils.mkdir_ine(WORK_DIR) ZQ_utils.copy_jpg_fold_to_fold(input_dir, WORK_DIR) print 'VisualSfM' cmdline = ZQ_utils.aug_path(os.path.join( VISUALSFM_BIN, 'VisualSfM.exe')) + ' sfm ' + ZQ_utils.aug_path( WORK_DIR) + ' ' + ZQ_utils.aug_path( os.path.join(WORK_DIR, 'visualsfm.nvm')) stats = os.system(cmdline) if stats != 0: sys.exit(1)
copy_and_resize_exe_name = os.path.join(OPENMVG_BIN,'copy_and_resize_fold_to_fold') ## RUN focal = 1000; pair_list_file = 'pair_list.txt' argc = len(sys.argv); if argc != 3 and argc != 4 and argc != 5: print('input_dir output_dir [focal] [pair_list_file]') input_dir = sys.argv[1].replace('/','\\') output_dir = sys.argv[2].replace('/','\\') time1 = time.time(); print(input_dir) print(output_dir) ZQ_utils.mkdir_ine(output_dir) print('Copy data to work directionary') ZQ_utils.cleardir_ine(WORK_DIR) ZQ_utils.mkdir_ine(WORK_DIR) ZQ_utils.mkdir_ine(matches_dir) ZQ_utils.mkdir_ine(reconstruction_dir) ZQ_utils.mkdir_ine(mvs_dir) time00 = time.time() #ZQ_utils.copy_jpg_fold_to_fold(input_dir, WORK_DIR) #ZQ_utils.copy_jpg_fold_to_fold_and_resize(exiv2_exe_name, ImageResize_exe_name,input_dir, WORK_DIR, '1920') if not ZQ_utils.copy_jpg_fold_to_fold_and_resize_multi_thread(copy_and_resize_exe_name,exiv2_exe_name, ImageResize_exe_name,input_dir, WORK_DIR, '1920','10'): print('fail') sys.exit(1); time01 = time.time()
VISUALSFM_BIN = 'visualsfm' OPENMVS_BIN = 'openMVGopenMVS' WORK_DIR = os.path.join(os.getcwd(),'openMVGopenMVS\\tmp') MESHLAB_DIR = 'C:\\Program Files\\VCG\\MeshLab' ## RUN if len(sys.argv) != 3: print 'input_dir output_dir' time1 = time.time() input_dir = sys.argv[1] output_dir = sys.argv[2] print input_dir print output_dir ZQ_utils.mkdir_ine(output_dir) print 'Copy data to work directionary' ZQ_utils.cleardir_ine(WORK_DIR) ZQ_utils.mkdir_ine(WORK_DIR) ZQ_utils.copy_jpg_fold_to_fold(input_dir, WORK_DIR) print 'VisualSfM' cmdline = ZQ_utils.aug_path(os.path.join(VISUALSFM_BIN,'VisualSfM.exe'))+' sfm '+ ZQ_utils.aug_path(WORK_DIR)+' '+ZQ_utils.aug_path(os.path.join(WORK_DIR,'visualsfm.nvm')) print cmdline os.system(cmdline) time2 = time.time() print 'visual sfm cost time: ' print time2-time1
## RUN focal = 1000 pair_list_file = 'pair_list.txt' argc = len(sys.argv) if argc != 4: print 'input_dir output_dir backup_dir' input_dir = sys.argv[1] output_dir = sys.argv[2] backup_dir = sys.argv[3] time1 = time.time() print input_dir print output_dir print backup_dir ZQ_utils.mkdir_ine(output_dir) print 'Copy data to work directionary' ZQ_utils.cleardir_ine(WORK_DIR) ZQ_utils.mkdir_ine(WORK_DIR) ZQ_utils.mkdir_ine(matches_dir) ZQ_utils.mkdir_ine(reconstruction_dir) ZQ_utils.copy_jpg_fold_to_fold(input_dir, WORK_DIR) cmdline = 'copy ' + ZQ_utils.aug_path(os.path.join( backup_dir, 'sfm_data.bin')) + ' ' + ZQ_utils.aug_path( os.path.join(reconstruction_dir, 'sfm_data_in.bin')) print cmdline stats = os.system(cmdline) if stats != 0: sys.exit(1)
## RUN focal = 1000 pair_list_file = 'pair_list.txt' argc = len(sys.argv) if argc != 3: print 'input_dir output_dir ' input_dir = sys.argv[1] output_dir = sys.argv[2] backup_dir = os.path.join(output_dir, 'backup') time1 = time.time() print input_dir print output_dir print backup_dir ZQ_utils.mkdir_ine(output_dir) ZQ_utils.mkdir_ine(backup_dir) print 'Copy data to work directionary' ZQ_utils.cleardir_ine(WORK_DIR) ZQ_utils.mkdir_ine(WORK_DIR) ZQ_utils.mkdir_ine(matches_dir) ZQ_utils.mkdir_ine(reconstruction_dir) ZQ_utils.copy_jpg_fold_to_fold(input_dir, WORK_DIR) print 'Run SFM PIPELINE' cmdline = ZQ_utils.aug_path( os.path.join(OPENMVG_BIN, 'openMVG_pipeline_for_VSExMotion.exe') ) + ' ' + ZQ_utils.aug_path(config_for_vse_file) stats = os.system(cmdline) if stats != 0: