Skip to content

alx/colmap-serverless

Folders and files

NameName
Last commit message
Last commit date

Latest commit

Β 

History

25 Commits
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 

Repository files navigation

colmap-serverless

Runpod

Serverless RunPod endpoint that runs COLMAP structure-from-motion on drone or handheld MP4 video. Part of the RunSplat pipeline.

Input: one or more MP4 video URLs
Output: COLMAP workspace (base64 tar.gz) ready for 3D Gaussian Splatting training

MP4 video(s)
    β”‚
    β–Ό  ffmpeg β€” extract up to 150 frames
    β”‚
    β–Ό  COLMAP feature_extractor
    β”‚
    β–Ό  COLMAP sequential_matcher / exhaustive_matcher
    β”‚
    β–Ό  COLMAP mapper (sparse reconstruction)
    β”‚
    β–Ό  COLMAP image_undistorter
    β”‚
    β–Ό  colmap_workspace.tar.gz (base64)

Why Gaussian Splatting?

Traditional photogrammetry outputs meshes or point clouds. Gaussian Splatting is different: it lets you fly through the scene and see it exactly as it is β€” from every angle β€” with real textures.

  • See your land as it really looks, not an abstraction
  • Easier to understand than technical maps or wireframes
  • Ideal for design reviews, planning, and client presentations
  • Take remote measurements without revisiting the site
  • No heavy software needed β€” runs in any modern browser
  • Track construction progress or erosion over time

COLMAP is the industry-standard open-source Structure-from-Motion tool that computes camera poses from overlapping images, producing the sparse point cloud and calibrated cameras that Gaussian Splatting trainers like Brush need as input.


Drone capture tips

For best COLMAP reconstruction results, circular flight patterns significantly outperform traditional grid surveys:

Unlike traditional grid or double-grid patterns, Circlegrammetry enables drones to fly in circular patterns, with the camera angled between 45Β° and 70Β° toward the center of each circle. This method captures images from more angles in fewer flights.

β€” SPH Engineering, Circlegrammetry

More viewing angles = more robust feature matching = better COLMAP reconstruction = better Gaussian Splat.


Stack

Component Version Role
COLMAP 4.0.3 Structure-from-Motion
ffmpeg system Frame extraction
CUDA 12.9 GPU feature extraction
RunPod SDK latest Serverless handler
Base image nvidia/cuda:12.9.0-devel-ubuntu24.04 Build stage
Runtime image nvidia/cuda:12.9.0-base-ubuntu24.04 Runtime stage

API

Input

{
  "input": {
    "video_url": "https://example.com/drone-flight.mp4",
    "num_frames": 150,
    "matching": "sequential",
    "camera_model": "SIMPLE_RADIAL",
    "sequential_overlap": 10,
    "quality": "high",
    "gpu": true
  }
}

Multiple videos (combined into one reconstruction):

{
  "input": {
    "video_urls": [
      "https://example.com/pass-north.mp4",
      "https://example.com/pass-south.mp4"
    ],
    "num_frames": 200,
    "matching": "sequential"
  }
}

Parameters

Parameter Type Default Description
video_url string β€” Single MP4 URL
video_urls string[] β€” Multiple MP4 URLs (combined reconstruction)
num_frames int 150 Max frames extracted per video, spread evenly across duration
matching string sequential sequential for video; exhaustive for unordered image sets
camera_model string SIMPLE_RADIAL See camera models below
sequential_overlap int 10 Adjacent frames to match per frame in sequential mode
quality string high Feature extraction quality: low / medium / high / extreme
gpu bool true GPU SIFT feature extraction and matching

Camera models

Model Use case
SIMPLE_RADIAL Standard video from phone or most drones
RADIAL Higher distortion lenses
OPENCV Known radial + tangential lens distortion
OPENCV_FISHEYE Wide-angle or fisheye drone cameras
PINHOLE Pre-calibrated camera, no distortion correction

Output

{
  "colmap_workspace_b64": "<base64 tar.gz of colmap/ directory>",
  "colmap_version": "4.0.3",
  "num_frames_extracted": 147,
  "status": "done"
}

The colmap_workspace_b64 field contains a gzipped tar archive of the colmap/ directory, which includes:

colmap/
β”œβ”€β”€ database.db          # Feature match database
β”œβ”€β”€ images/              # Undistorted frames (Brush input)
└── sparse/0/            # Camera poses + sparse point cloud
    β”œβ”€β”€ cameras.bin
    β”œβ”€β”€ images.bin
    └── points3D.bin

Pass this directly to brush-serverless as colmap_workspace_b64.


Local build & test

Requirements

Build

# First build compiles COLMAP 4.0.3 from source β€” allow ~20–30 min
docker build -t colmap-serverless:local .

# Stream output and save log
docker build -t colmap-serverless:local . 2>&1 | tee /tmp/build.log

# Filter for errors only
docker build -t colmap-serverless:local . 2>&1 | grep -E "^(ERROR|Step|error|failed)"

Test

./scripts/test_local.sh

# Skip rebuild if already built
./scripts/test_local.sh --no-build

The test downloads lighthouse.mp4, extracts 30 frames, runs the full COLMAP pipeline, and validates that colmap_workspace_b64 is present and non-empty in the output.

Manual run

docker run --rm --gpus all colmap-serverless:local \
  python3 handler.py --test_input '{
    "input": {
      "video_url": "https://github.com/alx/runsplat/releases/download/v0.1.5/lighthouse.mp4",
      "num_frames": 30,
      "matching": "sequential",
      "gpu": true
    }
  }'

COLMAP build-only stage

Test that COLMAP compiles without running the handler:

docker build --target colmap-builder -t colmap-builder . 2>&1 | tee /tmp/build-colmap.log

Publishing to RunPod Hub

  1. Verify the local build and test pass
  2. Push to GitHub and create a release: gh release create v1.0.0 --generate-notes
  3. RunPod Hub detects the release, builds the image, and runs .runpod/tests.json
  4. After tests pass, submit for review on the Hub page

Configuration is in .runpod/hub.json. Available presets:

  • Standard drone video β€” 150 frames, sequential matching, SIMPLE_RADIAL
  • Wide-angle / fisheye drone β€” 150 frames, sequential matching, OPENCV_FISHEYE
  • Dense / thorough reconstruction β€” 300 frames, exhaustive matching

COLMAP documentation


Related repos

Repo Role
runsplat Full pipeline orchestrator + result viewer
brush-serverless 3D Gaussian Splatting training (takes this output)

Credits

  • COLMAP β€” Structure-from-Motion and MVS
  • RunPod β€” Serverless GPU infrastructure
  • SPH Engineering β€” Circlegrammetry technique

About

No description, website, or topics provided.

Resources

License

Stars

Watchers

Forks

Packages

 
 
 

Contributors