PYTHON-OPENCV Tutorial -8-image Pyramid Fusion

Source: Internet
Author: User

Image Pyramid Fusion algorithm is mainly used in the stitching of two images. Two pictures with coincident areas, if directly based on the location to splice, then due to the two pictures of their own differences, the stitching finished picture will have a very obvious stitching line exists.

The simplest way to solve this problem is to add weights to the pixels in the coincident area of the two images (this operation can be interpreted as a feather processing effect).


Set a weight of W, there is a formula:PB (i,j) = (1-w) *pa (i,j) + W*PB (i,j) can calculate coincident region fused pixel values.

However, this simple feathering has a very high quality requirement for two images, which is not an ideal result for the case.

Therefore, in many cases, we will choose a slightly more complex image pyramid fusion algorithm to handle this coincident region.

Let's briefly describe the process of the entire algorithm, and then describe in detail

1. Generate a series of Gaussian pyramid images with the image to be processed.

2. The Laplacian pyramid image is computed according to the Gaussian pyramid image.

3. Reconstruct the fused image of the coincident region according to the Gaussian pyramid image and the Laplace Gold Tower image.

The process of establishing a Gaussian pyramid is as follows:

First Gaussian filtering of the original image, and then remove the filtered image after the even line and even sequence (so that the image size is 1/4 of the original image). Repeat this process until the required gold tower layer is reached. (The higher the number of layers, the smaller the graph, the No. 0 highest is defined here)


The process for establishing the Laplace Gold Tower is as follows:

First, we will use the high-level Gaussian pyramid image to reconstruct (expand) the lower-layer image. Here, we assume that the image of the No. 0 layer to reconstruct the 1th layer of image, because the size of the 0-layer image is 1-layer image 1/4, so we have to interpolate the 0-layer image, so that it reaches the size of the 1-layer image. Here, it is generally used to add 0 to the original image as even rows and even arrays, and then Gaussian filtering. (Note that the reconstructed first layer image here will certainly be different from the original first layer, since the missing information of the Gaussian filter is irreversible).


We get the reconstructed 1-layer image, then we subtract the reconstructed image with the original 1-layer image, we get the Laplace pyramid image of this layer. Then the process is repeated, and the entire Laplace image pyramid can be obtained.


The process of getting a fused image is as follows:

The nth-layer Gaussian pyramid image is added to the N-layer Laplacian pyramid image, and then the image of the n-1 layer is reconstructed with Gaussian interpolation method for the added image. And then use this reconstructed n-1 layer of image plus the n-1 image of the Laplace pyramid image, to reconstruct the image of the n-2 layer ... Repeat this process until the image is the right size.



In Python, the function of setting down a lower-level gold tower image isCv2.Pyrdown (), The function of rebuilding a high-level pyramid image is cv2. Pyrup ().



PYTHON-OPENCV Tutorial -8-image Pyramid Fusion

Related Article

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.