Git Product home page Git Product logo

panorama's Introduction

Panorama

Introduction

This is an panorama stitching program written in C++ from scratch. It mainly follows the routine described in the paper Automatic Panoramic Image Stitching using Invariant Features, which is also the one used by AutoStitch.

(Recently I'm working on refactoring & improvements, changes are expected)

Build Status

Compile Dependencies:

  • gcc >= 4.7
  • Eigen
  • FLANN (already included in the repository, slightly modified)
  • CImg (optional. already included in the repository)
  • libjpeg (optional. If you only need png, you can comment the jpeg macro in lib/imgio.cc)

Eigen, CImg and FLANN are header-only, to simplify the compilation on different platforms. CImg and libjpeg are only used to read and write images, so you can easily get rid of them.

Compile:

$ cd src; make

Options:

Three modes are available (set/unset the options in config.cfg):

  • cylinder mode. When the following conditions satisfied, this mode usually yields better results:

    • Images are taken with almost-pure single-direction rotation. (as common panoramas)
    • Images are given in the left-to-right order. (I might fix this in the future)
    • Images are taken with the same camera, and a good FOCAL_LENGTH is set.
  • camera estimation mode. No translation is the only requirement on cameras. It can usually work well as long as you don't have too few images. But it's slower because it needs to perform pairwise matches.

  • translation mode. Simply stitch images together by affine transformation. It works when camera performs pure translation. It also requires ordered input.

Some options you may care:

  • FOCAL_LENGTH: focal length of your camera in 35mm equivalent. Only used in cylinder mode.
  • LINEAR_INPUT: whether input images are ordered. it is required in CYLINDER and TRANS mode.
  • CROP: whether to crop the final image to avoid meaningless border.

Other parameters are quality-related. The default values are generally good for images with more than 0.7 megapixels. If your images are too small and cannot give satisfactory results, it might be better to resize your images rather than tune the parameters.

Run:

$ ./image-stitching <file1> <file2> ...

The default output file is out.jpg.

Before dealing with very large images (4 megapixels or more), it's better to resize them. (I might add this feature in the future)

In cylinder/translation mode, the input file names need to have the correct order.

Examples:

Zijing Apartment in Tsinghua University: dorm

Myselves: myself

Zijing Playground in Tsinghua University: planet

Carnegie Mellon University from 38 images cmu0 apple

For more examples, see results.

Speed & Memory:

In cylinder mode, it took 10 seconds to process 17 images of size 1000x660 on 2 x i5-2430M (pretty old cpu). I know there are room for speed up.

Memory consumption is known to be huge with default libc allocator. Simply use a modern allocator (e.g. tcmalloc, hoard) can help a lot.

Algorithms

  • Features: SIFT
  • Transformation: use RANSAC to estimate a homography or affine transformation.
  • Optimization: focal estimation, bundle adjustment, and some straightening tricks.

For details, please see my post.

panorama's People

Contributors

ppwwyyxx avatar mikeseven avatar

Watchers

 avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.