Stitching many images into panorama
OpenCV has a lot of Computer Vision algorithms. Some of them are low-level, while others are used in special cases. But there is functionality, which joins many algorithms together using everyday applications. One of these pipelines is panorama stitching. This rather complicated procedure can be done easily in OpenCV and gives decent results. This recipe shows you how to use OpenCV tools to create your own panorama.
Getting ready
Before you proceed with this recipe, you need to install the OpenCV version 3.3 (or greater) Python API package.
How to do it
You need to complete the following steps:
- Import the necessary modules:
import cv2 import numpy as np
- Load the images we're going to combine into a panorama:
images = [] images.append(cv2.imread('../data/panorama/0.jpg', cv2.IMREAD_COLOR)) images.append(cv2.imread('../data/panorama/1.jpg', cv2.IMREAD_COLOR))
- Create a panorama stitcher, pass your images to it, and parse the result:
stitcher = cv2.createStitcher()...