COLMAP 3.7 sequential_matcher headless: 'qt.qpa.xcb: could not connect to display' + SIGABRT; QT_QPA_PLATFORM=offscreen only gives 'Check failed: context_.create()'; use --SiftMatching.use_gpu 0
Setup: FROM docker.io/ubuntu:22.04 + apt-get install colmap (prints COLMAP 3.7 ... without CUDA), run from a Python script with subprocess.run([...], check=True) on drone photos. colmap feature_extractor ... --SiftExtraction.use_gpu 0 works. The next step, colmap sequential_matcher --database_path /app/database.db --SequentialMatching.overlap 10, dies right away:
qt.qpa.xcb: could not connect to display
qt.qpa.plugin: Could not load the Qt platform plugin "xcb" in "" even though it was found.
This application failed to start because no Qt platform plugin could be initialized.
*** SIGABRT ... QGuiApplicationPrivate::createPlatformIntegration() ... colmap::RunSequentialMatcher()
subprocess.CalledProcessError: ... died with <Signals.SIGABRT: 6>.Cause: --SiftMatching.use_gpu defaults to 1. In a non-CUDA build, 'GPU' matching means SiftGPU over OpenGL, so the matcher creates a QApplication to get a GL context. That needs a display. The extractor didn't crash only because extraction already had use_gpu 0.
The common advice, QT_QPA_PLATFORM=offscreen, doesn't fix it. Tested in the same image: Qt starts, then
F... opengl_utils.cc:56] Check failed: context_.create()
colmap::OpenGLContextManager::OpenGLContextManager()
colmap::SiftGPUFeatureMatcher::SiftGPUFeatureMatcher()and it still aborts (exit 134).
Fix: force CPU matching on every matcher you call:
colmap sequential_matcher --database_path db.db --SiftMatching.use_gpu 0
colmap exhaustive_matcher --database_path db.db --SiftMatching.use_gpu 0
colmap spatial_matcher --database_path db.db --SiftMatching.use_gpu 0and keep --SiftExtraction.use_gpu 0 on feature_extractor. With that, both matchers ran headless with no X or Qt environment variables (Matching image [1/3] in 0.100s ... Elapsed time). colmap mapper didn't touch Qt in the same test. A real GPU path needs a CUDA build plus GPU passthrough, or a virtual display (xvfb-run) for the OpenGL path. I didn't test those.
Side note: on an empty database the CPU matcher fails differently (Check failed: max_num_elems > 0 in cache.h). That only means no images or features were extracted, not a GPU problem.
Verify: colmap sequential_matcher -h | grep use_gpu shows --SiftMatching.use_gpu arg (=1). Run once with =0 and check that it prints Matching image [i/N] lines.