cvg/Hierarchical-Localization

POTRAIT AND LANDSCAPE INPUT IMAGE HAVE SAME DIMENTION

ichsan2895 opened this issue · 1 comments

  1. How to get dataset:
!gdown 1ChzTC_Vokc5ms0zIW23VH76maHUSq44p
!unzip ./IMAGES_KOPU.zip

There are 1 potrait and 8 landscape images
image

  1. How to reproduce the problem
%load_ext autoreload
%autoreload 2
import tqdm, tqdm.notebook
tqdm.tqdm = tqdm.notebook.tqdm  # notebook-friendly progress bars
from pathlib import Path
import numpy as np

from hloc import extract_features, match_features, reconstruction, visualization, pairs_from_exhaustive
from hloc.visualization import plot_images, read_image
from hloc.utils import viz_3d
import pycolmap

!rm -rf outputs/demo

images = Path('IMAGES_KOPU')
outputs = Path('outputs/demo/')

sfm_pairs = outputs / 'pairs-sfm.txt'
loc_pairs = outputs / 'pairs-loc.txt'
sfm_dir = outputs / 'sfm'
features = outputs / 'features.h5'
matches = outputs / 'matches.h5'

feature_conf = extract_features.confs['disk']
matcher_conf = match_features.confs['disk+lightglue']

references = [p.relative_to(images).as_posix() for p in (images).iterdir()]

extract_features.main(feature_conf, images, image_list=references, feature_path=features)
pairs_from_exhaustive.main(sfm_pairs, image_list=references)
match_features.main(matcher_conf, sfm_pairs, features=features, matches=matches);

model = reconstruction.main(sfm_dir, images, sfm_pairs, features, matches, image_list=references, image_options = pycolmap.ImageReaderOptions(camera_model="OPENCV"), camera_mode=pycolmap.CameraMode.PER_IMAGE)

!colmap model_converter \
    --input_path outputs/demo/sfm \
    --output_path outputs/demo/sfm \
    --output_type TXT

I got 8 of 8 camera poses (100%), BUT...

When I check outputs/demo/sfm/camera.txt, they have same images resolution despite there are 7 landscape and 1 potrait images as input.

# Camera list with one line of data per camera:
#   CAMERA_ID, MODEL, WIDTH, HEIGHT, PARAMS[]
# Number of cameras: 8
8 OPENCV 4624 3472 3431.8153080178317 3426.4558676979514 2312 1736 0.069663848029709402 -0.11169503006449635 0.0017684241581211366 -5.2135552842571731e-05
7 OPENCV 4624 3472 3411.7610366222016 3401.7932679455412 2312 1736 0.080475670074401692 -0.14904026955573982 0.0015083894052024232 0.00047500774034682746
6 OPENCV 4624 3472 3422.8288529552065 3414.4490665041803 2312 1736 0.055887185054300903 -0.065342316871946152 0.0012627306372721067 0.00053155844519777167
5 OPENCV 4624 3472 3416.0725985494091 3420.7164610250675 2312 1736 0.072027060336107035 -0.090443965238480153 0.0022844612228177376 -0.0023975410242926742
4 OPENCV 4624 3472 3402.5792224104084 3402.758775922578 2312 1736 0.060909793030826262 -0.063617958133933242 0.00052138216029011986 -0.0018946867856990367
3 OPENCV 4624 3472 3379.1492975083756 3394.374215682351 2312 1736 0.072554899416930468 -0.094489726072165992 0.00032094255971382992 -0.0028777045226310713
2 OPENCV 4624 3472 3398.1038880566525 3399.8474876884707 2312 1736 0.073159049911800098 -0.095484988345755806 0.0013039211757413344 -0.0046240762956675421
1 OPENCV 4624 3472 3904.6344277146127 3641.4935294209617 2312 1736 -0.89815524677533609 0.82415421002928757 0.06469235598473444 -0.0918769054581344
  1. System info:
pycolmap 0.7.0-dev (the latest commit)
hloc-1.5 (the latest commit)
Python 3.10.12
Colmap 3.9.1 with CUDA built from source with Ceres 2.1.0
Ubuntu 22.04 LTS