Self-hosted service
OpenStitching/stitching avatar
OpenStitching/stitching

OpenStitching/stitching: a Python wrapper around OpenCV's stitching module

A Python package for fast and robust Image Stitching

2,625 stars217 forksPythonApache-2.0

At a glance

What is it?
The package gives OpenCV's stitching pipeline a pip-installable CLI and a Stitcher class, with a headless variant and a Docker image. Here is what the documentation covers, and where it stops.
Who is it for?
Adopt it if you want OpenCV's stitching pipeline behind a pip install, a stitch CLI and a Stitcher class with named settings, and you are willing to inspect intermediate output when a panorama fails. Do not adopt it if you need a documented rollback path, published accuracy figures or per-stage error handling: the README does not describe any of these.
Can I use it commercially?
Yes. Apache-2.0 is a permissive licence: you can use, modify and sell software built on it, as long as you keep its copyright and licence notices.
Is it still maintained?
Yes. The repository last received commits 12 days ago.
What is it written in?
Mainly Python, according to GitHub's language statistics.

Answers come from the project's GitHub data, last synced on September 18, 2026, and from our analysis. They are not legal advice.

DEEP OPEN-SOURCE ANALYSIS

What OpenStitching/stitching actually is

This is a Python package that wraps OpenCV's stitching module. The README states it is "Based on opencv's stitching module" and "inspired by the stitching_detailed.py python command line tool". That sentence tells you what the project is and what it is not. It is not a new stitching algorithm. It is a packaging and interface layer over code that already ships with OpenCV, plus utility functions the README says let you "deeply analyse what's happening behind the stitching".

The audience follows from that. If you have OpenCV installed and you have ever copied stitching_detailed.py out of the samples directory to get a working panorama, this package replaces that copy with a maintained one that installs from PyPI. The repository topics list computer-vision, image-stitching, opencv-python, panorama and python, which matches the intended use. The README also points to a paper, "Automatic stitching of fragmented construction plans of hydraulic structures", as where the package was developed and used, so the original problem was document reconstruction rather than casual photo panoramas.

The mechanism: a Stitcher class, two variants, and verbose output

The public surface described in the README is small. You construct a Stitcher, optionally with a settings dictionary, and call stitch on a list of filenames, a wildcard pattern, or already loaded image arrays. The README shows the settings being passed two ways, as keyword arguments or as a dict expanded with **settings, and gives detector and confidence_threshold as the example keys. That is the whole configuration story as documented: named settings, no separate config file format described in the README.

Two variants exist. AffineStitcher is described as the script equivalent of the --affine CLI parameter, which suggests a different transform model for the camera arrangement. stitch_verbose is the script equivalent of -v, and the README says verbose mode creates a folder where all intermediate results are stored so you can find out where problems with your images are. That folder is the debugging interface. The README does not list what files land in it.

The tutorial repository is where the analysis functions are demonstrated. The README says you can "visualize the RANSAC matches between the images or the seam lines where the images are blended", and shows four rendered images with those captions. So the diagnostic path is: run verbose, then use the tutorial notebook to render matches and seams. Whether those utilities are importable functions or notebook-only code is not stated in the README.

Installing it and stitching a first panorama

The README gives two install paths. For a normal desktop environment with a display, install from PyPI:

bash
pip install stitching

For server or headless environments, the README names a separate distribution, stitching-headless:

bash
pip install stitching-headless

The Dockerfile in the repository confirms how the headless split is produced: it rewrites opencv-python to opencv-python-headless inside setup.cfg before building the wheel, then installs the wheel into a python:3.11-slim image. The same Dockerfile compiles largestinteriorrectangle at build time with a JIT import, and sets the entrypoint to stitch with a default argument of -h, working in /data. So a container user mounts a volume at /data.

After installation, the CLI is available. The README lists these forms:

bash
stitch -h
stitch *.jpg
stitch img_dir/IMG*.jpg
stitch img1.jpg img2.jpg img3.jpg

The first prints help. The second stitches every jpg in the current directory. The third restricts to files in img_dir starting with IMG. The fourth takes three explicit files. Add -v to any of them and, per the README, you get a folder of intermediate results. The Docker equivalent wraps the same CLI, with the README instructing you to read "current directory" as "/data":

bash
docker container run --rm -v /path/to/data:/data openstitching/stitch:{version} -h

For script use, the README's example is short. You import Stitcher, optionally pass settings, and call stitch with a list:

python
from stitching import Stitcher
stitcher = Stitcher(detector="sift", confidence_threshold=0.2)
panorama = stitcher.stitch(["img1.jpg", "img2.jpg", "img3.jpg"])

The wildcard form stitcher.stitch(["img?.jpg"]) and the pre-loaded array form using cv.imread are both shown in the README as alternatives to the filename list.

Where the documentation goes quiet

The README is a usage document, not a reference. It never states default values for detector or confidence_threshold, so the example values 0.2 and "sift" are illustrative rather than confirmed defaults. It does not describe what happens when stitching fails: no exception type, no return value for a failed match, no fallback behaviour. The only failure guidance is the -v flag and the instruction to look at intermediate results.

There is no rollback or version-pinning guidance beyond the Docker tag placeholder {version} in the run command. There are no published accuracy, speed or memory figures in the README, and none should be inferred from the phrase "fast and robust" in the package description. The requirements file pins opencv-python to 5.0.0.93 and lists largestinteriorrectangle and requests, which tells you the dependency footprint is not trivial, but the README does not discuss OpenCV version compatibility or what happens when a user's OpenCV differs from the pinned one.

The project also draws a boundary around support. The README says questions go to GitHub discussions and explicitly asks readers not to use the issue section for questions. If you need a guaranteed response channel, that is the stated policy.

When this is the wrong tool

If your images lack overlap or consistent exposure, no wrapper helps. The README's own troubleshooting advice is to inspect intermediate results, which implies failures are expected and diagnosed by eye rather than handled programmatically. A pipeline that must process thousands of image sets unattended, with automatic rejection of bad panoramas, gets no documented signal from this package about why a stitch failed.

If you need a specific blend or seam-finding algorithm that OpenCV's stitching module does not expose through the settings this package forwards, wrapping does not add it. The README does not claim any algorithm beyond what the underlying module provides.

If you are on a platform where the pinned OpenCV wheel is unavailable, the requirements pin becomes your problem. And if your task is not panorama stitching at all, the package name will not help you: the related search phrases around this term are dominated by sewing, wound closure and leathercraft, none of which this library does.

The alternative: calling OpenCV's stitching module directly

The honest alternative is OpenCV itself. The stitching module is already in opencv-python, and stitching_detailed.py, the sample the README cites as inspiration, is a working command line tool in the OpenCV repository. Using it directly means no extra dependency, no separate headless distribution to choose, and no wrapper version to track against your OpenCV version.

The difference in approach is what you give up. With raw OpenCV you assemble the pipeline yourself: feature detection, matching, estimation and blending are your code to write and maintain, and the sample script is a starting point rather than a supported API. This package turns that into a Stitcher object with named settings, a stitch command, an AffineStitcher variant and a verbose mode that dumps intermediates. You are trading control over the pipeline stages for a stable interface and a CLI. If you need to modify a stage, the wrapper is in your way; if you need a panorama today, it is not.

Maintenance, licence and upgrade cost

The last push to the default branch was on 2026-09-05, and v0.7.0 was released the same day, so the repository has been touched within the last two weeks. That is a fact about recency, not a promise about the future. The release history is uneven: v0.6.1 is dated 2024-10-14, v0.6.2 is dated 2026-08-21, and v0.7.0 followed two weeks later. Anyone pinning versions should read that gap as a signal that the cadence is not uniform.

The licence is Apache-2.0. That is a permissive licence with an explicit patent grant and a requirement to preserve notices and state changes, but the README's licence link points at a path in a different repository (lukasalexanderweber/lir), which is a documentation defect worth checking against the LICENSE file in this repository before you rely on it. This is not legal advice; read the LICENSE file itself.

Upgrade cost centres on the OpenCV pin. requirements.txt fixes opencv-python at 5.0.0.93, and the Dockerfile rewrites that to opencv-python-headless at build time. If you install the wheel rather than the container, your OpenCV version is whatever pip resolves, and the README does not describe a compatibility matrix. Upgrading this package may move your OpenCV version with it.

Editorial conclusion

Adopt it if you want OpenCV's stitching pipeline behind a pip install, a stitch CLI and a Stitcher class with named settings, and you are willing to inspect intermediate output when a panorama fails. Do not adopt it if you need a documented rollback path, published accuracy figures or per-stage error handling: the README does not describe any of these. Before committing, run stitch *.jpg -v on your own images, confirm the detector and confidence_threshold defaults suit your scene, and check the Apache-2.0 licence text in the repository against your distribution terms.

Frequently asked questions

How do I install OpenStitching/stitching?

Install it from PyPI with pip install stitching, or use pip install stitching-headless for server and headless environments. The README also points to a Docker image, openstitching/stitch, for users who do not want to set up Python.

How do I use OpenStitching/stitching from the command line?

After installation the stitch command is available. stitch *.jpg stitches all jpg files in the current directory, stitch img_dir/IMG*.jpg restricts to matching filenames in a directory, and adding -v stores intermediate results in a folder for troubleshooting.

Can I use OpenStitching/stitching in a Python script instead of the CLI?

Yes. The README shows importing Stitcher, optionally passing settings such as detector="sift" or confidence_threshold=0.2, and calling stitcher.stitch on a list of filenames, a wildcard pattern, or already loaded images.

Does OpenStitching/stitching work without a display, such as in Docker or on a server?

The README provides stitching-headless for server and headless environments, and the repository Dockerfile builds the image by replacing opencv-python with opencv-python-headless in setup.cfg. The container entrypoint is stitch and expects a volume mounted at /data.

What should I do if OpenStitching/stitching produces a bad panorama?

The README says verbose mode creates a folder where all intermediate results are stored so you can find out where problems with your images are. The companion tutorial notebook demonstrates visualising RANSAC matches and the seam lines where images are blended.

Official sources

  1. Issues
  2. License: Apache-2.0
  3. OpenStitching/stitching on GitHub
  4. README
  5. Releases
Community notes

Community notes