Metadata-Version: 2.4
Name: sfmtool
Version: 0.3
Classifier: Development Status :: 3 - Alpha
Classifier: Intended Audience :: Science/Research
Classifier: Intended Audience :: Developers
Classifier: Operating System :: Microsoft :: Windows
Classifier: Operating System :: POSIX :: Linux
Classifier: Operating System :: MacOS
Classifier: Programming Language :: Python :: 3
Classifier: Programming Language :: Python :: 3 :: Only
Classifier: Programming Language :: Python :: 3.14
Classifier: Programming Language :: Rust
Classifier: Topic :: Scientific/Engineering :: Image Processing
Classifier: Topic :: Scientific/Engineering :: Image Recognition
Classifier: Topic :: Multimedia :: Graphics :: 3D Modeling
Requires-Dist: click>=8
Requires-Dist: deadline>=0.60.7
Requires-Dist: numpy>=2
Requires-Dist: opencv-python-headless
Requires-Dist: pycolmap>=4.1.1,<5
Requires-Dist: xxhash>=3.4
License-File: LICENSE
Summary: Structure from Motion toolkit built on COLMAP: a CLI, file formats and a 3D viewer
Keywords: structure-from-motion,sfm,photogrammetry,colmap,3d-reconstruction,computer-vision
Author: Mark Wiebe
License-Expression: Apache-2.0
Requires-Python: >=3.14
Description-Content-Type: text/markdown; charset=UTF-8; variant=GFM
Project-URL: Documentation, https://sfmtool.github.io/sfmtool/
Project-URL: Homepage, https://github.com/sfmtool/sfmtool
Project-URL: Issues, https://github.com/sfmtool/sfmtool/issues
Project-URL: Repository, https://github.com/sfmtool/sfmtool

# SfM Tool

[![CI](https://github.com/sfmtool/sfmtool/actions/workflows/ci.yml/badge.svg)](https://github.com/sfmtool/sfmtool/actions/workflows/ci.yml)
[![codecov](https://codecov.io/gh/sfmtool/sfmtool/graph/badge.svg)](https://codecov.io/gh/sfmtool/sfmtool)

A tool for creating and exploring Structure from Motion (SfM) reconstructions,
built on [COLMAP](https://colmap.github.io/) and [OpenCV](https://opencv.org/).

Under construction - project is being restructured to better fit what it
evolved into.

## Components

- **`sfm` CLI** - Create workspaces, run SfM solves, and inspect reconstructions
- **SfM Explorer GUI** - View reconstructions in 3D, explore tracks and camera rays
- **Python bindings** - Access SfM functionality from Python via `sfmtool-py`

## Quick Start

```bash
# Create a workspace with your images
mkdir -p workspace/images
cp /path/to/images/*.jpg workspace/images/
cd workspace

# Initialize and solve
sfm ws init .
sfm solve -g images/

# Inspect the result
sfm inspect sfmr/[filename].sfmr
```

## Convert videos to image sequences

To try many different things with a particular 3D reconstruction, having the
data as a video complicates individual frame access. Therefore the `sfm` command expects you
to always convert to images first.

Here's an example of using [ffmpeg](https://www.ffmpeg.org/) to convert a
single video in the current directory into a sequence of images in a `frames`
subdirectory:

```bash
# Assumes there's one video in the current directory
VIDEO_FILE=$(echo *.mp4)

IMAGE_BASE=$(basename "$VIDEO_FILE")
IMAGE_BASE=${IMAGE_BASE%.*}

mkdir -p frames
ffmpeg -i "$VIDEO_FILE" \
    -qscale:v 2 \
    frames/"${IMAGE_BASE}_%04d.jpg"
```

## Building

This project uses [Pixi](https://pixi.sh/) for environment management with Rust and Python.

```bash
# Run the Sfm Explorer GUI
pixi run gui

# Run tests
pixi run test

# Serve docs locally
pixi run docs-serve
```

## Project Structure

```
crates/
  sfmtool-archive-io/       Shared ZIP + zstd container primitives
  sfmtool-sfmr-format/      .sfmr reconstruction file I/O
  sfmtool-sift-format/      SIFT feature file I/O
  sfmtool-matches-format/   Feature matches file I/O
  sfmtool-camrig-format/    .camrig camera-rig file I/O
  sfmtool-kdf-format/       .kdf kd-forest file I/O
  sfmtool-colmap/           COLMAP integration
  sfmtool-core/             Core project functionality
  sfm-explorer/             SfM Explorer GUI
  sfmtool-py/               Python bindings
```

## License

Apache-2.0

