OpenCV之图像金字塔
Posted MachineLP
tags:
篇首语:本文由小常识网(cha138.com)小编为大家整理,主要介绍了OpenCV之图像金字塔相关的知识,希望对你有一定的参考价值。
python代码:
import cv2 as cv
def pyramid_down(pyramid_images):
level = len(pyramid_images)
print("level = ",level)
for i in range(level-1, -1, -1):
expand = cv.pyrUp(pyramid_images[i])
cv.imshow("pyramid_down_"+str(i), expand)
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)
temp = dst.copy()
return pyramid_images
src = cv.imread("test.png")
cv.namedWindow("input", cv.WINDOW_AUTOSIZE)
cv.imshow("input", src)
# pyramid_up(src)
pyramid_down(pyramid_up(src))
cv.waitKey(0)
cv.destroyAllWindows()
以上是关于OpenCV之图像金字塔的主要内容,如果未能解决你的问题,请参考以下文章
youcans 的 OpenCV 例程200篇185.图像金字塔之高斯金字塔