OpenCV之拉普拉斯金字塔
Posted MachineLP
tags:
篇首语:本文由小常识网(cha138.com)小编为大家整理,主要介绍了OpenCV之拉普拉斯金字塔相关的知识,希望对你有一定的参考价值。
python代码:
import cv2 as cv
import numpy as np
def laplaian_demo(pyramid_images):
level = len(pyramid_images)
for i in range(level-1, -1, -1):
if (i-1) < 0:
h, w = src.shape[:2]
expand = cv.pyrUp(pyramid_images[i], dstsize=(w, h))
lpls = cv.subtract(src, expand) + 127
cv.imshow("lpls_" + str(i), lpls)
else:
h, w = pyramid_images[i-1].shape[:2]
expand = cv.pyrUp(pyramid_images[i], dstsize=(w, h))
lpls = cv.subtract(pyramid_images[i-1], expand) + 127
cv.imshow("lpls_"+str(i), lpls)
def pyramid_up(image, level=3):
temp = image.copy()
# cv.imshow("input", image)
pyramid_images = []
for i in range(level):
dst = cv.pyrDown(temp)
pyramid_images.append(dst)
# cv.imshow("pyramid_up_" + str(i), dst)
以上是关于OpenCV之拉普拉斯金字塔的主要内容,如果未能解决你的问题,请参考以下文章
youcans 的 OpenCV 例程200篇186.图像金字塔之拉普拉斯金字塔
OpenCV入门教程之十三OpenCV图像金字塔:高斯金字塔拉普拉斯金字塔与图片尺寸缩放