Skip to content

Stitcher

stitchingclassOpenCV 5.0.0
import { Stitcher } from '@banou/opencv-wasm'

Use after await initOpenCV(). See the initialization and named imports guide.

Native object: release it with using or delete(). Factories can return null; check before calling methods.

example: samples/cpp/snippets/stitching.cpp A basic example on image stitching example: samples/python/snippets/stitching.py A basic example on image stitching in Python. example: samples/cpp/stitching_detailed.cpp A detailed example on image stitching 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.

Note: - A basic example on image stitching can be found at opencv_source_code/samples/cpp/stitching.cpp

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

Constructors and members

static create

Creates a Stitcher configured in one of the stitching modes.

create(mode: number): Stitcher | null;
2 available overloads
create(): Stitcher | null;
create(mode: number): Stitcher | null;
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.

Returns

Stitcher class instance.

clone

Create another handle to the same native object. This retains the object without copying its pixels or algorithm state; dispose both handles separately.

clone(): this;
Returns

The this result.

registrationResol

Return the image resolution in megapixels used for feature registration.

registrationResol(): number;
Returns

The number result.

setRegistrationResol

Set the registration resol used by this Stitcher object.

setRegistrationResol(resol_mpx: number): void;
resol_mpx

resol mpx argument (number).

seamEstimationResol

Return the image resolution in megapixels used for seam estimation.

seamEstimationResol(): number;
Returns

The number result.

setSeamEstimationResol

Set the seam estimation resol used by this Stitcher object.

setSeamEstimationResol(resol_mpx: number): void;
resol_mpx

resol mpx argument (number).

compositingResol

Return the image resolution in megapixels used for panorama compositing; a negative value denotes original resolution.

compositingResol(): number;
Returns

The number result.

setCompositingResol

Set the compositing resol used by this Stitcher object.

setCompositingResol(resol_mpx: number): void;
resol_mpx

resol mpx argument (number).

panoConfidenceThresh

Return the confidence threshold used to decide whether images belong to the same panorama.

panoConfidenceThresh(): number;
Returns

The number result.

setPanoConfidenceThresh

Set the pano confidence thresh used by this Stitcher object.

setPanoConfidenceThresh(conf_thresh: number): void;
conf_thresh

conf thresh argument (number).

waveCorrection

Return whether wave-effect correction is enabled for the estimated camera rotations.

waveCorrection(): boolean;
Returns

The boolean result.

setWaveCorrection

Set the wave correction used by this Stitcher object.

setWaveCorrection(flag: boolean): void;
flag

flag argument (boolean).

interpolationFlags

Return the interpolation mode used when warping panorama images.

interpolationFlags(): number;
Returns

The number result.

setInterpolationFlags

Set the interpolation flags used by this Stitcher object.

setInterpolationFlags(interp_flags: number): void;
interp_flags

interp flags argument (number).

estimateTransform

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

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

estimateTransform(images: MatVector, masks: MatVector): number;
2 available overloads
estimateTransform(images: MatVector): number;
estimateTransform(images: MatVector, masks: MatVector): number;
images

Input images.

masks

Masks for each input image specifying where to look for keypoints (optional).

Returns

Status code.

composePanorama

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.

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

composePanorama(pano: Mat): number;
pano

Output destination, filled by the native operation. Final pano.

Returns

Status code.

composePanorama1

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.

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

composePanorama1(images: MatVector, pano: Mat): number;
images

Input images.

pano

Output destination, filled by the native operation. Final pano.

Returns

Status code.

stitch

These functions try to stitch the given images.

stitch(images: MatVector, pano: Mat): number;
images

Input images.

pano

Output destination, filled by the native operation. Final pano.

Returns

Status code.

stitch1

These functions try to stitch the given images.

stitch1(images: MatVector, masks: MatVector, pano: Mat): number;
images

Input images.

masks

Masks for each input image specifying where to look for keypoints (optional).

pano

Output destination, filled by the native operation. Final pano.

Returns

Status code.

component

Returns indices of input images used in panorama stitching

component(): IntVector;
Returns

The IntVector result. Release returned native handles with using or delete(), including handles nested in results.

cameras

Returns estimated camera parameters for all stitched images

cameras(): detail__CameraParamsVector;
Returns

The detail__CameraParamsVector result. Release returned native handles with using or delete(), including handles nested in results.

workScale

Return the scale used to resize input images during feature registration.

workScale(): number;
Returns

The number result.

These signatures describe this package. Upstream documentation can mention optional backends that are absent from this build. Check runtime compatibility before choosing a backend or file format.