Laplace and Gaussian pyramid pyramid restore the image opencv Gaussian pyramid within the Python implementation

To achieve this thing, in fact, just three steps to achieve

First: the original image is sampled using the obtained image downsampling Gauss
Second: the use of the sampling and down-sampling the original image to obtain images of Gaussian Laplacian image
Third: using the Laplacian image and the original image to obtain image upsampling

Code

import cv2

img = cv2.imread('../data/1.jpg')
g0 = img

g1 = cv2.pyrDown(g0)  # 计算下采样

laplacian0 = g0 - cv2.pyrUp(g1)  # 计算拉普拉斯

# 通过拉普拉斯还原原图像
origin = laplacian0 + cv2.pyrUp(g1)

cv2.imshow('g0', g0)
cv2.imshow('origin', origin)
cv2.waitKey()
cv2.destroyAllWindows()

The growth rate after the work, the nature of the differences can be divided into: awareness and capacity gaps

Published 45 original articles · won praise 24 · views 3423

Guess you like

Origin blog.csdn.net/my_name_is_learn/article/details/103999437