class cv::Stitcher

Overview

High level image stitcher. More…

#include <stitching.hpp>

class Stitcher
{
public:
    // enums

    enum
    {
        ORIG_RESOL = -1,
    };

    enum Mode;
    enum Status;

    // methods

    static
    Ptr<Stitcher>
    create(
        Mode mode = PANORAMA,
        bool try_use_gpu = false
        );

    static
    Stitcher
    createDefault(bool try_use_gpu = false);

    Ptr<detail::Blender>
    blender();

    const Ptr<detail::Blender>
    blender() const;

    Ptr<detail::BundleAdjusterBase>
    bundleAdjuster();

    const Ptr<detail::BundleAdjusterBase>
    bundleAdjuster() const;

    std::vector<detail::CameraParams>
    cameras() const;

    std::vector<int>
    component() const;

    Status
    composePanorama(OutputArray pano);

    Status
    composePanorama(
        InputArrayOfArrays images,
        OutputArray pano
        );

    double
    compositingResol() const;

    Status
    estimateTransform(InputArrayOfArrays images);

    Status
    estimateTransform(
        InputArrayOfArrays images,
        const std::vector<std::vector<Rect>>& rois
        );

    Ptr<detail::ExposureCompensator>
    exposureCompensator();

    const Ptr<detail::ExposureCompensator>
    exposureCompensator() const;

    Ptr<detail::FeaturesFinder>
    featuresFinder();

    const Ptr<detail::FeaturesFinder>
    featuresFinder() const;

    Ptr<detail::FeaturesMatcher>
    featuresMatcher();

    const Ptr<detail::FeaturesMatcher>
    featuresMatcher() const;

    const cv::UMat&
    matchingMask() const;

    double
    panoConfidenceThresh() const;

    double
    registrationResol() const;

    double
    seamEstimationResol() const;

    Ptr<detail::SeamFinder>
    seamFinder();

    const Ptr<detail::SeamFinder>
    seamFinder() const;

    void
    setBlender(Ptr<detail::Blender> b);

    void
    setBundleAdjuster(Ptr<detail::BundleAdjusterBase> bundle_adjuster);

    void
    setCompositingResol(double resol_mpx);

    void
    setExposureCompensator(Ptr<detail::ExposureCompensator> exposure_comp);

    void
    setFeaturesFinder(Ptr<detail::FeaturesFinder> features_finder);

    void
    setFeaturesMatcher(Ptr<detail::FeaturesMatcher> features_matcher);

    void
    setMatchingMask(const cv::UMat& mask);

    void
    setPanoConfidenceThresh(double conf_thresh);

    void
    setRegistrationResol(double resol_mpx);

    void
    setSeamEstimationResol(double resol_mpx);

    void
    setSeamFinder(Ptr<detail::SeamFinder> seam_finder);

    void
    setWarper(Ptr<WarperCreator> creator);

    void
    setWaveCorrection(bool flag);

    void
    setWaveCorrectKind(detail::WaveCorrectKind kind);

    Status
    stitch(
        InputArrayOfArrays images,
        OutputArray pano
        );

    Status
    stitch(
        InputArrayOfArrays images,
        const std::vector<std::vector<Rect>>& rois,
        OutputArray pano
        );

    Ptr<WarperCreator>
    warper();

    const Ptr<WarperCreator>
    warper() const;

    bool
    waveCorrection() const;

    detail::WaveCorrectKind
    waveCorrectKind() const;

    double
    workScale() const;
};

Detailed Documentation

High level image stitcher.

It’s possible to use this class without being aware of the entire stitching pipeline. However, to be able to achieve higher stitching stability and quality of the final images at least being familiar with the theory is recommended.

  • A basic example on image stitching can be found at opencv_source_code/samples/cpp/stitching.cpp
    • A detailed example on image stitching can be found at opencv_source_code/samples/cpp/stitching_detailed.cpp

Methods

static
Ptr<Stitcher>
create(
    Mode mode = PANORAMA,
    bool try_use_gpu = false
    )

Creates a Stitcher configured in one of the stitching modes.

Parameters:

mode Scenario for stitcher operation. This is usually determined by source of images to stitch and their transformation. Default parameters will be chosen for operation in given scenario.
try_use_gpu Flag indicating whether GPU should be used whenever it’s possible.

Returns:

Stitcher class instance.

static
Stitcher
createDefault(bool try_use_gpu = false)

Creates a stitcher with the default parameters.

Parameters:

try_use_gpu Flag indicating whether GPU should be used whenever it’s possible.

Returns:

Stitcher class instance.

Status
composePanorama(OutputArray pano)

This is an overloaded member function, provided for convenience. It differs from the above function only in what argument(s) it accepts.

Status
composePanorama(
    InputArrayOfArrays images,
    OutputArray pano
    )

These functions try to compose the given images (or images stored internally from the other function calls) into the final pano under the assumption that the image transformations were estimated before.

Use the functions only if you’re aware of the stitching pipeline, otherwise use Stitcher::stitch.

Parameters:

images Input images.
pano Final pano.

Returns:

Status code.

Status
estimateTransform(InputArrayOfArrays images)

This is an overloaded member function, provided for convenience. It differs from the above function only in what argument(s) it accepts.

Status
estimateTransform(
    InputArrayOfArrays images,
    const std::vector<std::vector<Rect>>& rois
    )

These functions try to match the given images and to estimate rotations of each camera.

Use the functions only if you’re aware of the stitching pipeline, otherwise use Stitcher::stitch.

Parameters:

images Input images.
rois Region of interest rectangles.

Returns:

Status code.

Status
stitch(
    InputArrayOfArrays images,
    OutputArray pano
    )

This is an overloaded member function, provided for convenience. It differs from the above function only in what argument(s) it accepts.

Status
stitch(
    InputArrayOfArrays images,
    const std::vector<std::vector<Rect>>& rois,
    OutputArray pano
    )

These functions try to stitch the given images.

Parameters:

images Input images.
rois Region of interest rectangles.
pano Final pano.

Returns:

Status code.