Upload 7 files
Browse files- colmap_matcher.sh +195 -0
- glomap_mapper.sh +79 -0
- glomap_reconstruction.sh +73 -0
- vocab_tree_flickr100K_words1M.bin +3 -0
- vocab_tree_flickr100K_words256K.bin +3 -0
- vocab_tree_flickr100K_words32K.bin +3 -0
- vslamlab_glomap_settings.yaml +45 -0
colmap_matcher.sh
ADDED
|
@@ -0,0 +1,195 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
#!/bin/bash
|
| 2 |
+
echo ""
|
| 3 |
+
echo "Executing colmapMatcher.sh ..."
|
| 4 |
+
|
| 5 |
+
sequence_path="$1"
|
| 6 |
+
exp_folder="$2"
|
| 7 |
+
exp_id="$3"
|
| 8 |
+
matcher_type="$4" # Options: exhaustive, sequential
|
| 9 |
+
use_gpu="$5"
|
| 10 |
+
settings_yaml="$6"
|
| 11 |
+
calibration_yaml="$7"
|
| 12 |
+
rgb_txt="$8"
|
| 13 |
+
|
| 14 |
+
exp_folder_colmap="${exp_folder}/colmap_${exp_id}"
|
| 15 |
+
rgb_path="${sequence_path}/$(awk '{print $2}' "${rgb_txt}" | awk -F'/' 'NR==1 {print $1}')"
|
| 16 |
+
|
| 17 |
+
calibration_model=$(grep -oP '(?<=Camera\.model:\s)[\w]+' "$calibration_yaml")
|
| 18 |
+
|
| 19 |
+
fx=$(grep -oP '(?<=Camera\.fx:\s)-?\d+\.\d+' "$calibration_yaml")
|
| 20 |
+
fy=$(grep -oP '(?<=Camera\.fy:\s)-?\d+\.\d+' "$calibration_yaml")
|
| 21 |
+
cx=$(grep -oP '(?<=Camera\.cx:\s)-?\d+\.\d+' "$calibration_yaml")
|
| 22 |
+
cy=$(grep -oP '(?<=Camera\.cy:\s)-?\d+\.\d+' "$calibration_yaml")
|
| 23 |
+
|
| 24 |
+
k1=$(grep -oP '(?<=Camera\.k1:\s)-?\d+\.\d+' "$calibration_yaml")
|
| 25 |
+
k2=$(grep -oP '(?<=Camera\.k2:\s)-?\d+\.\d+' "$calibration_yaml")
|
| 26 |
+
p1=$(grep -oP '(?<=Camera\.p1:\s)-?\d+\.\d+' "$calibration_yaml")
|
| 27 |
+
p2=$(grep -oP '(?<=Camera\.p2:\s)-?\d+\.\d+' "$calibration_yaml")
|
| 28 |
+
k3=$(grep -oP '(?<=Camera\.k3:\s)-?\d+\.\d+' "$calibration_yaml")
|
| 29 |
+
k4=0.0
|
| 30 |
+
k5=0.0
|
| 31 |
+
k6=0.0
|
| 32 |
+
|
| 33 |
+
# Reading settings from yaml file
|
| 34 |
+
feature_extractor_SiftExtraction_num_octaves=$(yq '.feature_extractor.SiftExtraction_num_octaves // 4.0' $settings_yaml)
|
| 35 |
+
feature_extractor_SiftExtraction_octave_resolution=$(yq '.feature_extractor.SiftExtraction_octave_resolution // 3.0' $settings_yaml)
|
| 36 |
+
feature_extractor_SiftExtraction_peak_threshold=$(yq '.feature_extractor.SiftExtraction_peak_threshold // 0.0066666666666666671' $settings_yaml)
|
| 37 |
+
feature_extractor_SiftExtraction_edge_threshold=$(yq '.feature_extractor.SiftExtraction_edge_threshold // 10.0' $settings_yaml)
|
| 38 |
+
feature_extractor_SiftExtraction_dsp_min_scale=$(yq '.feature_extractor.SiftExtraction_dsp_min_scale // 0.1666666666666666' $settings_yaml)
|
| 39 |
+
feature_extractor_SiftExtraction_dsp_max_scale=$(yq '.feature_extractor.SiftExtraction_dsp_max_scale // 3.0' $settings_yaml)
|
| 40 |
+
feature_extractor_SiftExtraction_dsp_num_scales=$(yq '.feature_extractor.SiftExtraction_dsp_num_scales // 10.0' $settings_yaml)
|
| 41 |
+
|
| 42 |
+
matcher_SiftMatching_max_ratio=$(yq '.matcher.SiftMatching_max_ratio // 0.80000000000000004' $settings_yaml)
|
| 43 |
+
matcher_SiftMatching_max_distance=$(yq '.matcher.SiftMatching_max_distance // 0.69999999999999996' $settings_yaml)
|
| 44 |
+
matcher_TwoViewGeometry_min_num_inliers=$(yq '.matcher.TwoViewGeometry_min_num_inliers // 15.0' $settings_yaml)
|
| 45 |
+
matcher_TwoViewGeometry_max_error=$(yq '.matcher.TwoViewGeometry_max_error // 4.0' $settings_yaml)
|
| 46 |
+
matcher_TwoViewGeometry_confidence=$(yq '.matcher.TwoViewGeometry_confidence // 0.999' $settings_yaml)
|
| 47 |
+
matcher_TwoViewGeometry_min_inlier_ratio=$(yq '.matcher.TwoViewGeometry_min_inlier_ratio // 0.25' $settings_yaml)
|
| 48 |
+
matcher_SequentialMatching_overlap=$(yq '.matcher.SequentialMatching_overlap // 10.0' $settings_yaml)
|
| 49 |
+
matcher_SequentialMatching_quadratic_overlap=$(yq '.matcher.SequentialMatching_quadratic_overlap // 1.0' $settings_yaml)
|
| 50 |
+
matcher_ExhaustiveMatching_block_size=$(yq '.matcher.ExhaustiveMatching_block_size // 50.0' $settings_yaml)
|
| 51 |
+
|
| 52 |
+
# Create colmap image list
|
| 53 |
+
colmap_image_list="${exp_folder_colmap}/colmap_image_list.txt"
|
| 54 |
+
awk '{split($2, arr, "/"); print arr[2]}' "$rgb_txt" > "$colmap_image_list"
|
| 55 |
+
|
| 56 |
+
# Create Colmap Database
|
| 57 |
+
database="${exp_folder_colmap}/colmap_database.db"
|
| 58 |
+
rm -rf ${database}
|
| 59 |
+
colmap database_creator --database_path ${database}
|
| 60 |
+
|
| 61 |
+
################################################################################
|
| 62 |
+
echo " colmap feature_extractor ..."
|
| 63 |
+
|
| 64 |
+
if [ "${calibration_model}" == "UNKNOWN" ]
|
| 65 |
+
then
|
| 66 |
+
echo " camera model : $calibration_model"
|
| 67 |
+
colmap feature_extractor \
|
| 68 |
+
--database_path ${database} \
|
| 69 |
+
--image_path ${rgb_path} \
|
| 70 |
+
--image_list_path ${colmap_image_list} \
|
| 71 |
+
--ImageReader.camera_model SIMPLE_PINHOLE \
|
| 72 |
+
--ImageReader.single_camera 1 \
|
| 73 |
+
--ImageReader.single_camera_per_folder 1 \
|
| 74 |
+
--SiftExtraction.use_gpu ${use_gpu} \
|
| 75 |
+
--SiftExtraction.num_octaves ${feature_extractor_SiftExtraction_num_octaves} \
|
| 76 |
+
--SiftExtraction.octave_resolution ${feature_extractor_SiftExtraction_octave_resolution} \
|
| 77 |
+
--SiftExtraction.peak_threshold ${feature_extractor_SiftExtraction_peak_threshold} \
|
| 78 |
+
--SiftExtraction.edge_threshold ${feature_extractor_SiftExtraction_edge_threshold} \
|
| 79 |
+
--SiftExtraction.dsp_min_scale ${feature_extractor_SiftExtraction_dsp_min_scale} \
|
| 80 |
+
--SiftExtraction.dsp_max_scale ${feature_extractor_SiftExtraction_dsp_max_scale} \
|
| 81 |
+
--SiftExtraction.dsp_num_scales ${feature_extractor_SiftExtraction_dsp_num_scales}
|
| 82 |
+
fi
|
| 83 |
+
|
| 84 |
+
feature_extractor_SiftExtraction_dsp_num_scales=$(yq '.feature_extractor.SiftExtraction_dsp_num_scales // 10.0' $settings_yaml)
|
| 85 |
+
|
| 86 |
+
|
| 87 |
+
if [ "${calibration_model}" == "PINHOLE" ]
|
| 88 |
+
then
|
| 89 |
+
echo " camera model : $calibration_model"
|
| 90 |
+
colmap feature_extractor \
|
| 91 |
+
--database_path ${database} \
|
| 92 |
+
--image_path ${rgb_path} \
|
| 93 |
+
--image_list_path ${colmap_image_list} \
|
| 94 |
+
--ImageReader.camera_model ${calibration_model} \
|
| 95 |
+
--ImageReader.single_camera 1 \
|
| 96 |
+
--ImageReader.single_camera_per_folder 1 \
|
| 97 |
+
--SiftExtraction.use_gpu ${use_gpu} \
|
| 98 |
+
--ImageReader.camera_params "${fx}, ${fy}, ${cx}, ${cy}" \
|
| 99 |
+
--SiftExtraction.num_octaves ${feature_extractor_SiftExtraction_num_octaves} \
|
| 100 |
+
--SiftExtraction.octave_resolution ${feature_extractor_SiftExtraction_octave_resolution} \
|
| 101 |
+
--SiftExtraction.peak_threshold ${feature_extractor_SiftExtraction_peak_threshold} \
|
| 102 |
+
--SiftExtraction.edge_threshold ${feature_extractor_SiftExtraction_edge_threshold} \
|
| 103 |
+
--SiftExtraction.dsp_min_scale ${feature_extractor_SiftExtraction_dsp_min_scale} \
|
| 104 |
+
--SiftExtraction.dsp_max_scale ${feature_extractor_SiftExtraction_dsp_max_scale} \
|
| 105 |
+
--SiftExtraction.dsp_num_scales ${feature_extractor_SiftExtraction_dsp_num_scales}
|
| 106 |
+
fi
|
| 107 |
+
|
| 108 |
+
if [ "${calibration_model}" == "OPENCV" ]
|
| 109 |
+
then
|
| 110 |
+
echo " camera model : $calibration_model"
|
| 111 |
+
colmap feature_extractor \
|
| 112 |
+
--database_path ${database} \
|
| 113 |
+
--image_path ${rgb_path} \
|
| 114 |
+
--image_list_path ${colmap_image_list} \
|
| 115 |
+
--ImageReader.camera_model ${calibration_model} \
|
| 116 |
+
--ImageReader.single_camera 1 \
|
| 117 |
+
--ImageReader.single_camera_per_folder 1 \
|
| 118 |
+
--SiftExtraction.use_gpu ${use_gpu} \
|
| 119 |
+
--ImageReader.camera_params "${fx}, ${fy}, ${cx}, ${cy}, ${k1}, ${k2}, ${p1}, ${p2}" \
|
| 120 |
+
--SiftExtraction.num_octaves ${feature_extractor_SiftExtraction_num_octaves} \
|
| 121 |
+
--SiftExtraction.octave_resolution ${feature_extractor_SiftExtraction_octave_resolution} \
|
| 122 |
+
--SiftExtraction.peak_threshold ${feature_extractor_SiftExtraction_peak_threshold} \
|
| 123 |
+
--SiftExtraction.edge_threshold ${feature_extractor_SiftExtraction_edge_threshold} \
|
| 124 |
+
--SiftExtraction.dsp_min_scale ${feature_extractor_SiftExtraction_dsp_min_scale} \
|
| 125 |
+
--SiftExtraction.dsp_max_scale ${feature_extractor_SiftExtraction_dsp_max_scale} \
|
| 126 |
+
--SiftExtraction.dsp_num_scales ${feature_extractor_SiftExtraction_dsp_num_scales}
|
| 127 |
+
fi
|
| 128 |
+
|
| 129 |
+
if [ "${calibration_model}" == "OPENCV_FISHEYE" ]
|
| 130 |
+
then
|
| 131 |
+
echo " camera model : $calibration_model"
|
| 132 |
+
colmap feature_extractor \
|
| 133 |
+
--database_path ${database} \
|
| 134 |
+
--image_path ${rgb_path} \
|
| 135 |
+
--image_list_path ${colmap_image_list} \
|
| 136 |
+
--ImageReader.camera_model ${calibration_model} \
|
| 137 |
+
--ImageReader.single_camera 1 \
|
| 138 |
+
--ImageReader.single_camera_per_folder 1 \
|
| 139 |
+
--SiftExtraction.use_gpu ${use_gpu} \
|
| 140 |
+
--ImageReader.camera_params "${fx}, ${fy}, ${cx}, ${cy}, ${k1}, ${k2}, ${k3}, ${k4}" \
|
| 141 |
+
--SiftExtraction.num_octaves ${feature_extractor_SiftExtraction_num_octaves} \
|
| 142 |
+
--SiftExtraction.octave_resolution ${feature_extractor_SiftExtraction_octave_resolution} \
|
| 143 |
+
--SiftExtraction.peak_threshold ${feature_extractor_SiftExtraction_peak_threshold} \
|
| 144 |
+
--SiftExtraction.edge_threshold ${feature_extractor_SiftExtraction_edge_threshold} \
|
| 145 |
+
--SiftExtraction.dsp_min_scale ${feature_extractor_SiftExtraction_dsp_min_scale} \
|
| 146 |
+
--SiftExtraction.dsp_max_scale ${feature_extractor_SiftExtraction_dsp_max_scale} \
|
| 147 |
+
--SiftExtraction.dsp_num_scales ${feature_extractor_SiftExtraction_dsp_num_scales}
|
| 148 |
+
fi
|
| 149 |
+
|
| 150 |
+
################################################################################
|
| 151 |
+
if [ "${matcher_type}" == "exhaustive" ]
|
| 152 |
+
then
|
| 153 |
+
echo " colmap exhaustive_matcher ..."
|
| 154 |
+
colmap exhaustive_matcher \
|
| 155 |
+
--database_path ${database} \
|
| 156 |
+
--SiftMatching.use_gpu ${use_gpu} \
|
| 157 |
+
--SiftMatching.max_ratio "${matcher_SiftMatching_max_ratio}" \
|
| 158 |
+
--SiftMatching.max_distance "${matcher_SiftMatching_max_distance}" \
|
| 159 |
+
--TwoViewGeometry.min_num_inliers "${matcher_TwoViewGeometry_min_num_inliers}" \
|
| 160 |
+
--TwoViewGeometry.max_error "${matcher_TwoViewGeometry_max_error}" \
|
| 161 |
+
--TwoViewGeometry.confidence "${matcher_TwoViewGeometry_confidence}" \
|
| 162 |
+
--TwoViewGeometry.min_inlier_ratio "${matcher_TwoViewGeometry_min_inlier_ratio}" \
|
| 163 |
+
--ExhaustiveMatching.block_size "${matcher_ExhaustiveMatching_block_size}"
|
| 164 |
+
|
| 165 |
+
fi
|
| 166 |
+
|
| 167 |
+
if [ "${matcher_type}" == "sequential" ]
|
| 168 |
+
then
|
| 169 |
+
num_rgb=$(wc -l < ${rgb_txt})
|
| 170 |
+
|
| 171 |
+
# Pick vocabulary tree based on the number of images
|
| 172 |
+
vocabulary_tree="Baselines/glomap/vocab_tree_flickr100K_words32K.bin"
|
| 173 |
+
if [ "$num_rgb" -gt 1000 ]; then
|
| 174 |
+
vocabulary_tree="Baselines/glomap/vocab_tree_flickr100K_words256K.bin"
|
| 175 |
+
fi
|
| 176 |
+
if [ "$num_rgb" -gt 10000 ]; then
|
| 177 |
+
vocabulary_tree="Baselines/glomap/vocab_tree_flickr100K_words1M.bin"
|
| 178 |
+
fi
|
| 179 |
+
|
| 180 |
+
echo " colmap sequential_matcher ..."
|
| 181 |
+
echo " Vocabulary Tree: $vocabulary_tree"
|
| 182 |
+
colmap sequential_matcher \
|
| 183 |
+
--database_path "${database}" \
|
| 184 |
+
--SequentialMatching.loop_detection 1 \
|
| 185 |
+
--SequentialMatching.vocab_tree_path ${vocabulary_tree} \
|
| 186 |
+
--SiftMatching.use_gpu "${use_gpu}" \
|
| 187 |
+
--SiftMatching.max_ratio "${matcher_SiftMatching_max_ratio}" \
|
| 188 |
+
--SiftMatching.max_distance "${matcher_SiftMatching_max_distance}" \
|
| 189 |
+
--TwoViewGeometry.min_num_inliers "${matcher_TwoViewGeometry_min_num_inliers}" \
|
| 190 |
+
--TwoViewGeometry.max_error "${matcher_TwoViewGeometry_max_error}" \
|
| 191 |
+
--TwoViewGeometry.confidence "${matcher_TwoViewGeometry_confidence}" \
|
| 192 |
+
--TwoViewGeometry.min_inlier_ratio "${matcher_TwoViewGeometry_min_inlier_ratio}" \
|
| 193 |
+
--SequentialMatching.overlap "${matcher_SequentialMatching_overlap}" \
|
| 194 |
+
--SequentialMatching.quadratic_overlap "${matcher_SequentialMatching_quadratic_overlap}"
|
| 195 |
+
fi
|
glomap_mapper.sh
ADDED
|
@@ -0,0 +1,79 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
#!/bin/bash
|
| 2 |
+
echo "Executing glomapMapper.sh ..."
|
| 3 |
+
|
| 4 |
+
sequence_path="$1"
|
| 5 |
+
exp_folder="$2"
|
| 6 |
+
exp_id="$3"
|
| 7 |
+
verbose="$4"
|
| 8 |
+
settings_yaml="$5"
|
| 9 |
+
calibration_yaml="$6"
|
| 10 |
+
rgb_txt="$7"
|
| 11 |
+
|
| 12 |
+
|
| 13 |
+
exp_folder_colmap="${exp_folder}/colmap_${exp_id}"
|
| 14 |
+
rgb_path="${sequence_path}/$(awk '{print $2}' "${rgb_txt}" | awk -F'/' 'NR==1 {print $1}')"
|
| 15 |
+
|
| 16 |
+
calibration_model=$(grep -oP '(?<=Camera\.model:\s)[\w]+' "$calibration_yaml")
|
| 17 |
+
echo " camera model : $calibration_model"
|
| 18 |
+
optimize_intrinsics="0"
|
| 19 |
+
skip_view_graph_calibration="1"
|
| 20 |
+
if [ "${calibration_model}" == "UNKNOWN" ]
|
| 21 |
+
then
|
| 22 |
+
optimize_intrinsics="1"
|
| 23 |
+
skip_view_graph_calibration="0"
|
| 24 |
+
fi
|
| 25 |
+
|
| 26 |
+
# Reading settings from yaml file
|
| 27 |
+
BundleAdjustment_thres_loss_function=$(yq '.BundleAdjustment.thres_loss_function // 1.0' $settings_yaml)
|
| 28 |
+
RelPoseEstimation_max_epipolar_error=$(yq '.RelPoseEstimation.max_epipolar_error // 1.0' $settings_yaml)
|
| 29 |
+
GlobalPositioning_thres_loss_function=$(yq '.GlobalPositioning.thres_loss_function // 0.10000000000000001' $settings_yaml)
|
| 30 |
+
|
| 31 |
+
Triangulation_complete_max_reproj_error=$(yq '.Triangulation.complete_max_reproj_error // 15.0' $settings_yaml)
|
| 32 |
+
Triangulation_merge_max_reproj_error=$(yq '.Triangulation.merge_max_reproj_error // 15.0' $settings_yaml)
|
| 33 |
+
Triangulation_min_angle=$(yq '.Triangulation.min_angle // 1.0' $settings_yaml)
|
| 34 |
+
Triangulation_min_num_matches=$(yq '.Triangulation.min_num_matches // 15.0' $settings_yaml)
|
| 35 |
+
|
| 36 |
+
Thresholds_max_epipolar_error_E=$(yq '.Thresholds.max_epipolar_error_E // 1.0' $settings_yaml)
|
| 37 |
+
Thresholds_max_epipolar_error_F=$(yq '.Thresholds.max_epipolar_error_F // 4.0' $settings_yaml)
|
| 38 |
+
Thresholds_max_epipolar_error_H=$(yq '.Thresholds.max_epipolar_error_H // 4.0' $settings_yaml)
|
| 39 |
+
|
| 40 |
+
Thresholds_min_inlier_num=$(yq '.Thresholds.min_inlier_num // 30.0' $settings_yaml)
|
| 41 |
+
Thresholds_min_inlier_ratio=$(yq '.Thresholds.min_inlier_ratio // 0.25' $settings_yaml)
|
| 42 |
+
Thresholds_max_rotation_error=$(yq '.Thresholds.max_rotation_error // 10.0' $settings_yaml)
|
| 43 |
+
|
| 44 |
+
Thresholds_max_angle_error=$(yq '.Thresholds.max_angle_error // 1.0' $settings_yaml)
|
| 45 |
+
Thresholds_max_reprojection_error=$(yq '.Thresholds.max_reprojection_error // 0.01' $settings_yaml)
|
| 46 |
+
Thresholds_min_triangulation_angle=$(yq '.Thresholds.min_triangulation_angle // 1.0' $settings_yaml)
|
| 47 |
+
|
| 48 |
+
|
| 49 |
+
echo " glomap mapper ..."
|
| 50 |
+
database="${exp_folder_colmap}/colmap_database.db"
|
| 51 |
+
|
| 52 |
+
glomap mapper \
|
| 53 |
+
--database_path ${database} \
|
| 54 |
+
--image_path ${rgb_path} \
|
| 55 |
+
--output_path ${exp_folder_colmap} \
|
| 56 |
+
--skip_view_graph_calibration "${skip_view_graph_calibration}" \
|
| 57 |
+
--RelPoseEstimation.max_epipolar_error "${RelPoseEstimation_max_epipolar_error}" \
|
| 58 |
+
--GlobalPositioning.thres_loss_function "${GlobalPositioning_thres_loss_function}" \
|
| 59 |
+
--BundleAdjustment.optimize_intrinsics "$optimize_intrinsics" #\
|
| 60 |
+
# --BundleAdjustment.thres_loss_function "${BundleAdjustment_thres_loss_function}" \
|
| 61 |
+
# --Thresholds.max_epipolar_error_E "${Thresholds_max_epipolar_error_E}" \
|
| 62 |
+
# --Thresholds.max_epipolar_error_F "${Thresholds_max_epipolar_error_F}" \
|
| 63 |
+
# --Thresholds.max_epipolar_error_H "${Thresholds_max_epipolar_error_H}" \
|
| 64 |
+
# --Thresholds.min_inlier_num "${Thresholds_min_inlier_num}" \
|
| 65 |
+
# --Thresholds.min_inlier_ratio "${Thresholds_min_inlier_ratio}" \
|
| 66 |
+
# --Thresholds.max_rotation_error "${Thresholds_max_rotation_error}" \
|
| 67 |
+
# --Thresholds.max_angle_error "${Thresholds_max_angle_error}" \
|
| 68 |
+
# --Thresholds.max_reprojection_error "${Thresholds_max_reprojection_error}" \
|
| 69 |
+
# --Thresholds.min_triangulation_angle "${Thresholds_min_triangulation_angle}" \
|
| 70 |
+
# --Triangulation.complete_max_reproj_error "${Triangulation_complete_max_reproj_error}" \
|
| 71 |
+
# --Triangulation.merge_max_reproj_error "${Triangulation_merge_max_reproj_error}" \
|
| 72 |
+
# --Triangulation.min_angle "${Triangulation_min_angle}" \
|
| 73 |
+
# --Triangulation.min_num_matches "${Triangulation_min_num_matches}"
|
| 74 |
+
|
| 75 |
+
echo " colmap model_converter ..."
|
| 76 |
+
colmap model_converter \
|
| 77 |
+
--input_path ${exp_folder_colmap}/0 --output_path ${exp_folder_colmap} --output_type TXT
|
| 78 |
+
|
| 79 |
+
|
glomap_reconstruction.sh
ADDED
|
@@ -0,0 +1,73 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
#!/bin/bash
|
| 2 |
+
|
| 3 |
+
# Function to split key-value pairs and assign them to variables
|
| 4 |
+
matcher_type="exhaustive"
|
| 5 |
+
use_gpu="1"
|
| 6 |
+
verbose="0"
|
| 7 |
+
settings_yaml=""
|
| 8 |
+
|
| 9 |
+
split_and_assign() {
|
| 10 |
+
local input=$1
|
| 11 |
+
local key=$(echo $input | cut -d':' -f1)
|
| 12 |
+
local value=$(echo $input | cut -d':' -f2-)
|
| 13 |
+
eval $key=$value
|
| 14 |
+
}
|
| 15 |
+
|
| 16 |
+
# Split the input string into individual components
|
| 17 |
+
for ((i=1; i<=$#; i++)); do
|
| 18 |
+
split_and_assign "${!i}"
|
| 19 |
+
done
|
| 20 |
+
|
| 21 |
+
exp_id=$(printf "%05d" ${exp_id})
|
| 22 |
+
|
| 23 |
+
echo "Sequence Path: $sequence_path"
|
| 24 |
+
echo "Experiment Folder: $exp_folder"
|
| 25 |
+
echo "Experiment ID: $exp_id"
|
| 26 |
+
echo "Verbose: $verbose"
|
| 27 |
+
echo "matcher_type: $matcher_type"
|
| 28 |
+
echo "use_gpu: $use_gpu"
|
| 29 |
+
echo "settings_yaml: $settings_yaml"
|
| 30 |
+
echo "calibration_yaml: $calibration_yaml"
|
| 31 |
+
echo "rgb_txt: $rgb_txt"
|
| 32 |
+
|
| 33 |
+
exp_folder_colmap="${exp_folder}/colmap_${exp_id}"
|
| 34 |
+
rm -rf "$exp_folder_colmap"
|
| 35 |
+
mkdir "$exp_folder_colmap"
|
| 36 |
+
|
| 37 |
+
export QT_QPA_PLATFORM_PLUGIN_PATH="$CONDA_PREFIX/plugins/platforms"
|
| 38 |
+
|
| 39 |
+
# Run COLMAP scripts for matching and mapping
|
| 40 |
+
./Baselines/glomap/colmap_matcher.sh $sequence_path $exp_folder $exp_id $matcher_type $use_gpu ${settings_yaml} ${calibration_yaml} ${rgb_txt}
|
| 41 |
+
./Baselines/glomap/glomap_mapper.sh $sequence_path $exp_folder $exp_id ${verbose} ${settings_yaml} ${calibration_yaml} ${rgb_txt}
|
| 42 |
+
|
| 43 |
+
# Convert COLMAP outputs to a format suitable for VSLAM-Lab
|
| 44 |
+
python Baselines/glomap/colmap_to_vslamlab.py $sequence_path $exp_folder $exp_id $verbose $rgb_txt
|
| 45 |
+
|
| 46 |
+
# Get colmap stats
|
| 47 |
+
colmap_stats_csv="${exp_folder}/${exp_id}_colmap_stats.csv"
|
| 48 |
+
if [[ ! -f "$colmap_stats_csv" ]]; then
|
| 49 |
+
echo "File,Cameras,Images,Registered Images,Points,Observations,Mean Track Length,Mean Observations per Image,Mean Reprojection Error" > "$colmap_stats_csv"
|
| 50 |
+
fi
|
| 51 |
+
colmap_stats=$(pixi run -e colmap colmap model_analyzer --path "$exp_folder_colmap" 2>&1)
|
| 52 |
+
cameras=$(echo "$colmap_stats" | grep -oP "(?<=Cameras: )\d+")
|
| 53 |
+
images=$(echo "$colmap_stats" | grep -oP "(?<=Images: )\d+")
|
| 54 |
+
registered_images=$(echo "$colmap_stats" | grep -oP "(?<=Registered images: )\d+")
|
| 55 |
+
points=$(echo "$colmap_stats" | grep -oP "(?<=Points: )\d+")
|
| 56 |
+
observations=$(echo "$colmap_stats" | grep -oP "(?<=Observations: )\d+")
|
| 57 |
+
mean_track_length=$(echo "$colmap_stats" | grep -oP "(?<=Mean track length: )\d+\.\d+")
|
| 58 |
+
mean_observations_per_image=$(echo "$colmap_stats" | grep -oP "(?<=Mean observations per image: )\d+\.\d+")
|
| 59 |
+
mean_reprojection_error=$(echo "$colmap_stats" | grep -oP "(?<=Mean reprojection error: )\d+\.\d+")
|
| 60 |
+
echo "$exp_folder_colmap,${cameras:-0},${images:-0},${registered_images:-0},${points:-0},${observations:-0},${mean_track_length:-0},${mean_observations_per_image:-0},${mean_reprojection_error:-0}" >> "$colmap_stats_csv"
|
| 61 |
+
|
| 62 |
+
if [ "$verbose" -eq 1 ]; then
|
| 63 |
+
exp_folder_colmap="${exp_folder}/colmap_${exp_id}"
|
| 64 |
+
rgb_path="${sequence_path}/$(awk '{print $2}' "${rgb_txt}" | awk -F'/' 'NR==1 {print $1}')"
|
| 65 |
+
database="${exp_folder_colmap}/colmap_database.db"
|
| 66 |
+
colmap gui --import_path "${exp_folder_colmap}/0" --database_path ${database} --image_path ${rgb_path}
|
| 67 |
+
fi
|
| 68 |
+
|
| 69 |
+
|
| 70 |
+
# Remove colmap data
|
| 71 |
+
rm -rf ${exp_folder_colmap}
|
| 72 |
+
|
| 73 |
+
|
vocab_tree_flickr100K_words1M.bin
ADDED
|
@@ -0,0 +1,3 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
version https://git-lfs.github.com/spec/v1
|
| 2 |
+
oid sha256:fb60f7ba8081ee5c278f03c62329a374d1b24136b374a49393b453db1529a8c6
|
| 3 |
+
size 460952780
|
vocab_tree_flickr100K_words256K.bin
ADDED
|
@@ -0,0 +1,3 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
version https://git-lfs.github.com/spec/v1
|
| 2 |
+
oid sha256:d2055600452a531b5b0a62aa5943e1a07195273dc4eeebcf23d3a924d881d53a
|
| 3 |
+
size 117893693
|
vocab_tree_flickr100K_words32K.bin
ADDED
|
@@ -0,0 +1,3 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
version https://git-lfs.github.com/spec/v1
|
| 2 |
+
oid sha256:d37d8f19ee0a49705c4c0b06967a08cedfed5cf86519eada3271497256732bc2
|
| 3 |
+
size 15229678
|
vslamlab_glomap_settings.yaml
ADDED
|
@@ -0,0 +1,45 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
BundleAdjustment:
|
| 2 |
+
thres_loss_function: 1.0
|
| 3 |
+
|
| 4 |
+
RelPoseEstimation:
|
| 5 |
+
max_epipolar_error: 1.0
|
| 6 |
+
|
| 7 |
+
GlobalPositioning:
|
| 8 |
+
thres_loss_function: 0.10000000000000001
|
| 9 |
+
|
| 10 |
+
Triangulation:
|
| 11 |
+
complete_max_reproj_error: 15.0
|
| 12 |
+
merge_max_reproj_error: 15.0
|
| 13 |
+
min_angle: 1.0
|
| 14 |
+
min_num_matches: 15
|
| 15 |
+
|
| 16 |
+
Thresholds:
|
| 17 |
+
max_angle_error: 1.0
|
| 18 |
+
max_reprojection_error: 0.01
|
| 19 |
+
min_triangulation_angle: 1.0
|
| 20 |
+
min_inlier_num: 30.0
|
| 21 |
+
min_inlier_ratio: 0.25
|
| 22 |
+
max_rotation_error: 10.0
|
| 23 |
+
max_epipolar_error_E: 1.0
|
| 24 |
+
max_epipolar_error_F: 4.0
|
| 25 |
+
max_epipolar_error_H: 4.0
|
| 26 |
+
|
| 27 |
+
feature_extractor:
|
| 28 |
+
SiftExtraction_num_octaves: 4
|
| 29 |
+
SiftExtraction_octave_resolution: 3
|
| 30 |
+
SiftExtraction_peak_threshold: 0.0066666666666666671
|
| 31 |
+
SiftExtraction_edge_threshold: 10.0
|
| 32 |
+
SiftExtraction_dsp_min_scale: 0.1666666666666666
|
| 33 |
+
SiftExtraction_dsp_max_scale: 3.0
|
| 34 |
+
SiftExtraction_dsp_num_scales: 10
|
| 35 |
+
|
| 36 |
+
matcher:
|
| 37 |
+
SiftMatching_max_ratio: 0.80000000000000004
|
| 38 |
+
SiftMatching_max_distance: 0.69999999999999996
|
| 39 |
+
TwoViewGeometry_min_num_inliers: 15
|
| 40 |
+
TwoViewGeometry_max_error: 4.0
|
| 41 |
+
TwoViewGeometry_confidence: 0.999
|
| 42 |
+
TwoViewGeometry_min_inlier_ratio: 0.25
|
| 43 |
+
SequentialMatching_overlap: 10
|
| 44 |
+
SequentialMatching_quadratic_overlap: 1
|
| 45 |
+
ExhaustiveMatching_block_size: 50
|