pycolmap icon indicating copy to clipboard operation
pycolmap copied to clipboard

Usage according to README gives unlikely results of reprojection error

Open jingyibo123 opened this issue 3 years ago • 3 comments

Hi,

Thanks for maintaining the package.

I'm trying to analyse the reprojection error of a simple SFM project (the south-building), but the calculated reprojection error are way too large to be true (1000+ pixels) Is there a possible erronous usage? Code snippet is below, thanks.

import numpy as np
import pycolmap

sfm = pycolmap.Reconstruction('south-building/colmap/sparse')

for id, pt3d in sfm.points3D.items():
    for track in pt3d.track.elements:
        img = sfm.images[track.image_id]
        cam = sfm.cameras[img.camera_id]

        pt2d = img.points2D[track.point2D_idx]
        assert pt2d.point3D_id == id

        pt2d_ = cam.world_to_image(img.project(pt3d.xyz))

        rpjerr = np.linalg.norm(pt2d.xy - pt2d_)

        print(rpjerr)

jingyibo123 avatar Jun 23 '22 03:06 jingyibo123

The code looks OK. Does the reconstruction look good in the COLMAP GUI?

sarlinpe avatar Aug 11 '22 09:08 sarlinpe

The reconstruction looks correct, it's done using automatic reconstruction on the demo south building.

jingyibo123 avatar Aug 11 '22 11:08 jingyibo123

I tested this on a local reconstruction and it's working fine (low reprojection errors). Could you provide the sparse folder such that we can reproduce the issue?

mihaidusmanu avatar Aug 22 '22 11:08 mihaidusmanu