Search code examples
pythonopencvcomputer-visionimage-stitchingopencv-stitching

How do I access the camera/transform parameters in cv2.Stitcher?


I am trying to stitch together a bunch of microscope images, but I need to keep track of the physical location of each image. Before stitching, I know the coordinates of each individual image, but after stitching the Python method only returns the stitched image and some status flag.

How do I obtain the (affine) transformations that were automatically estimated in cv2.Stitcher.stitch()?

I know the full pipeline can be viewed in the C++ source code and there's a high-level flow chart, but if I have to obtain those parameters that way, I basically have to re-implement cv2.Stitcher myself...


Solution

  • There is a python wrapper around the OpenCV stitching module: stitching

    In this packge you can easily access the cameras parameter within the stitch method in the Stitcher class. See also the tutorial.

    Disclaimer: I'm the maintainer of this package