From 152ff1fff21abff0400bfa6df9cc9ee50c9b9694 Mon Sep 17 00:00:00 2001 From: ingra14m <1261238025@qq.com> Date: Mon, 27 Nov 2023 14:47:16 +0800 Subject: [PATCH] Remove unrelated code --- utils/preprocess.py | 79 --------------------------------------------- 1 file changed, 79 deletions(-) delete mode 100644 utils/preprocess.py diff --git a/utils/preprocess.py b/utils/preprocess.py deleted file mode 100644 index caf35b9..0000000 --- a/utils/preprocess.py +++ /dev/null @@ -1,79 +0,0 @@ -# @title Configure dataset directories -import os -from pathlib import Path - -# @markdown The base directory for all captures. This can be anything if you're running this notebook on your own Jupyter runtime. -save_dir = '/data00/yzy/Git_Project/data/dynamic/mine/' # @param {type: 'string'} -capture_name = 'lemon' # @param {type: 'string'} -# The root directory for this capture. -root_dir = Path(save_dir, capture_name) -# Where to save RGB images. -rgb_dir = root_dir / 'rgb' -rgb_raw_dir = root_dir / 'rgb-raw' -# Where to save the COLMAP outputs. -colmap_dir = root_dir / 'colmap' -colmap_db_path = colmap_dir / 'database.db' -colmap_out_path = colmap_dir / 'sparse' - -colmap_out_path.mkdir(exist_ok=True, parents=True) -rgb_raw_dir.mkdir(exist_ok=True, parents=True) - -print(f"""Directories configured: - root_dir = {root_dir} - rgb_raw_dir = {rgb_raw_dir} - rgb_dir = {rgb_dir} - colmap_dir = {colmap_dir} -""") - -# ==================== colmap ========================= -# @title Extract features. -# @markdown Computes SIFT features and saves them to the COLMAP DB. -share_intrinsics = True # @param {type: 'boolean'} -assume_upright_cameras = True # @param {type: 'boolean'} - -# @markdown This sets the scale at which we will run COLMAP. A scale of 1 will be more accurate but will be slow. -colmap_image_scale = 4 # @param {type: 'number'} -colmap_rgb_dir = rgb_dir / f'{colmap_image_scale}x' - -# @markdown Check this if you want to re-process SfM. -overwrite = False # @param {type: 'boolean'} - -if overwrite and colmap_db_path.exists(): - colmap_db_path.unlink() - -os.system('colmap feature_extractor \ ---SiftExtraction.use_gpu 0 \ ---SiftExtraction.upright {int(assume_upright_cameras)} \ ---ImageReader.camera_model OPENCV \ ---ImageReader.single_camera {int(share_intrinsics)} \ ---database_path "{str(colmap_db_path)}" \ ---image_path "{str(colmap_rgb_dir)}"') - -# @title Match features. -# @markdown Match the SIFT features between images. Use `exhaustive` if you only have a few images and use `vocab_tree` if you have a lot of images. - -match_method = 'exhaustive' # @param ["exhaustive", "vocab_tree"] - -if match_method == 'exhaustive': - os.system('colmap exhaustive_matcher \ - --SiftMatching.use_gpu 0 \ - --database_path "{str(colmap_db_path)}"') - -# @title Reconstruction. -# @markdown Run structure-from-motion to compute camera parameters. - -refine_principal_point = True # @param {type:"boolean"} -min_num_matches = 32 # @param {type: 'number'} -filter_max_reproj_error = 2 # @param {type: 'number'} -tri_complete_max_reproj_error = 2 # @param {type: 'number'} - -os.system('colmap mapper \ - --Mapper.ba_refine_principal_point {int(refine_principal_point)} \ - --Mapper.filter_max_reproj_error $filter_max_reproj_error \ - --Mapper.tri_complete_max_reproj_error $tri_complete_max_reproj_error \ - --Mapper.min_num_matches $min_num_matches \ - --database_path "{str(colmap_db_path)}" \ - --image_path "{str(colmap_rgb_dir)}" \ - --export_path "{str(colmap_out_path)}"') - -print("debug")