Skip to content

probable bug and question #7

Open
@Baptiste-AIST

Description

@Baptiste-AIST

Hello,
First of all, I think there might be a bug in the colmap_project.py file Line 166:
self._src_image_path: Path = self._dense_base_path.joinpath('images')
I think it is supposed to be
self._src_image_path: Path = self._project_path.joinpath('images') ?

When I tried to load a project I think I got some problem loading the images.

Something else, I have a question regarding the transformations used between the extrinsics, and qvec.

I'm just testing few things, loading a colmap project from the .bin files of the sparse reconstruction.
I also exported as text the same project.

Now I'm comparing the values from the extrinsics matrices converted to quaternion using the rotmat2qvec() function and qvec from the images.txt and find some sign problem

This is the operation I'm doing:

R, t = extrinsics[:3, :3], extrinsics[:3, 3]

Rxx, Ryx, Rzx, Rxy, Ryy, Rzy, Rxz, Ryz, Rzz = R.flat
K = np.array([
    [Rxx - Ryy - Rzz, 0, 0, 0],
    [Ryx + Rxy, Ryy - Rxx - Rzz, 0, 0],
    [Rzx + Rxz, Rzy + Ryz, Rzz - Rxx - Ryy, 0],
    [Ryz - Rzy, Rzx - Rxz, Rxy - Ryx, Rxx + Ryy + Rzz]]) / 3.0
eigvals, eigvecs = np.linalg.eigh(K)
qvec = eigvecs[[3, 0, 1, 2], np.argmax(eigvals)]
if qvec[0] < 0:
    qvec *= -1

Here is an example result

extrinsics 3x3
[[ 0.84069511 0.52485483 -0.13326339 0.36173603]
[-0.05035232 0.32079831 0.94580817 -1.3479446 ]
[ 0.53916266 -0.78842618 0.29612123 -0.29920324]
[ 0. 0. 0. 1. ]]

qvec (from image.qvec)
[0.78383906 0.55312195 0.2144656 0.18345831]
transformed extrinsic to qvec
[ 0.78383906 -0.55312195 -0.2144656 -0.18345831]

from images.txt
IMAGE_ID 0.78383905532074405 0.55312195025968414 0.21446559699355383 0.18345830916316025 -0.21066262776005473 0.0066597845729506923 1.4117036089633237 CAMERA_ID NAME

I'm not too sure why the sign is different
PS: I edited the result from images.txt, it was correct

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions