1 __author__ = "WSX" 2 import cv2 as cv 3 import numpy as np 4 # 高斯金字塔 5 #金字塔 原理 ==》 高斯模糊+ 降采样 6 #金字塔 原理 ==》扩大+ 卷积 7 #降采样 取图像的 偶数行偶数裂 生成的图 8 9 def jinzita( level ,img ): 10 temp = img.copy() 11 level = level 12 pyr_img = [] 13 14 for i in range(level): 15 dst = cv.pyrDown( temp ) #pyrup 和pyrDown 相反 16 pyr_img.append( dst ) 17 cv.imshow( "pyr" + str(i),dst) 18 temp = dst.copy() 19 # 拉普拉斯金字塔 20 21 def main(): 22 img = cv.imread("1.JPG") 23 cv.namedWindow("Show", cv.WINDOW_AUTOSIZE) 24 cv.imshow("Show", img) 25 26 jinzita(4, img) #三级金字塔 27 cv.waitKey(0) 28 cv.destroyAllWindows() 29 30 main()
11、OpenCV Python 图像金字塔
猜你喜欢
转载自www.cnblogs.com/WSX1994/p/9155513.html
今日推荐
周排行