Skip to Content
OpenCV 4 with Python Blueprints - Second Edition
book

OpenCV 4 with Python Blueprints - Second Edition

by Dr. Menua Gevorgyan, Michael Beyeler (USD), Arsen Mamikonyan, Michael Beyeler
March 2020
Intermediate to advanced
366 pages
9h 8m
English
Packt Publishing
Content preview from OpenCV 4 with Python Blueprints - Second Edition

Blending the images together

First, we create a MultiBandBlender object, which will help us merge images together. Instead of just picking values from one or the other image, blender will do interpolation between the available values:

    blender = cv2.detail_MultiBandBlender()    blend_width = np.sqrt(canvas_size[2] * canvas_size[3]) * 5 / 100    blender.setNumBands((np.log(blend_width) / np.log(2.) - 1.).astype(np.int))    blender.prepare(canvas_size)

Then, for each of the connected images, we do the following:

  1. We warp the image and get the corner locations:
    for i, img in enumerate(conn_images):        K = cameras[i].K().astype(np.float32)        corner, image_wp = warper.warp(img, K, cameras[i].R,                                       cv2.INTER_LINEAR, cv2.BORDER_REFLECT)
  1. Then, calculate the
Become an O’Reilly member and get unlimited access to this title plus top books and audiobooks from O’Reilly and nearly 200 top publishers, thousands of courses curated by job role, 150+ live events each month,
and much more.
Start your free trial

You might also like

OpenCV with Python Blueprints

OpenCV with Python Blueprints

Michael Beyeler, Michael Beyeler (USD)
OpenCV 3 Computer Vision with Python Cookbook

OpenCV 3 Computer Vision with Python Cookbook

Aleksei Spizhevoi, Aleksandr Rybnikov
Mastering OpenCV 4 with Python

Mastering OpenCV 4 with Python

Alberto Fernández Villán

Publisher Resources

ISBN: 9781789801811Supplemental Content