cvg / pyceres

Factor graphs with Ceres in Python
Apache License 2.0
247 stars 34 forks source link

Update to Colmap 3.9.1 and added Dockerfile. #26

Closed pablospe closed 9 months ago

pablospe commented 9 months ago

This PR updates the changes made to Colmap 3.9 and adds a Dockerfile. Usage:

export COLMAP_VERSION=3.9.1
export CUDA_ARCHITECTURES=70
docker build -t pyceres \
    --build-arg COLMAP_VERSION=${COLMAP_VERSION}  \
    --build-arg CUDA_ARCHITECTURES=${CUDA_ARCHITECTURES}  \
    -f Dockerfile .

A possible improvement for a future pull request is to create a runtime docker stage that only installs the essential dependencies and uses the compiled ceres-solver and colmap from the builder stage (this will reduce the docker image size considerably).

pablospe commented 9 months ago

@Phil26AT @sarlinpe I was wondering if you could take a look to this PR.

sarlinpe commented 9 months ago

LGTM. I don't use Docker so I don't really understand all these details.

sarlinpe commented 9 months ago

@pablospe Since COLMAP 3.9.1 the quaternions follow the Eigen format (xyzw instead of wxyz) but this wasn't updated here - so the user need to manually handle any conversion.

pablospe commented 9 months ago

Yes, you are right, this is not handle it here. Should we revert these changes?

sarlinpe commented 9 months ago

I'd rather revert for now and do a proper upgrade in https://github.com/cvg/pyceres/pull/27 - can you submit one and keep the Docker stuff if you need it?

pablospe commented 9 months ago

Yes, it makes sense to revert. I'll create another PR with only the Dockerfile. You could also take the changes from this PR, like the rename of WorldToImage for ImgFromCam: see in bundle.cc.

pablospe commented 9 months ago

One question, it only uses only the camera models from Colmap, right? I was wondering if it would make sense to simply take a copy the models.h to avoid Colmap dependency in this repo? It is like a circular dependency, for compiling Colmap you need ceres, and for pyceres you need Colmap :)

sarlinpe commented 9 months ago

My plan is to move the bundle & PGO cost functions to pycolmap, such that pyceres handles only the core features without any dependency on COLMAP. But this requires some updates upstream to add covariances.

pablospe commented 9 months ago

Related PR (for the Dockerfile part): https://github.com/cvg/pyceres/pull/31