网页制作模板田田田田田田田田田田田田田田,网站文章优化事项,网站建设最花时间的是,域名申请哪个网站好图像金字塔是一种图像处理技术#xff0c;它通过不断降低图像的分辨率#xff0c;形成一系列图像。金字塔分为两种类型#xff1a;高斯金字塔和拉普拉斯金字塔。
高斯金字塔#xff08;Gaussian Pyramid#xff09;#xff1a;
高斯金字塔是通过使用高斯滤波和降采样它通过不断降低图像的分辨率形成一系列图像。金字塔分为两种类型高斯金字塔和拉普拉斯金字塔。
高斯金字塔Gaussian Pyramid
高斯金字塔是通过使用高斯滤波和降采样缩小操作构建的。每一层的图像都是前一层图像的一部分。在OpenCV中可以使用cv2.pyrDown() 和 cv2.pyrUp() 函数构建高斯金字塔。
cv2.pyrDown(src[, dst[, dstsize[, borderType]]]): 通过高斯内核进行降采样缩小图像。cv2.pyrUp(src[, dst[, dstsize[, borderType]]]): 通过插值进行升采样放大图像。
示例代码
import cv2# 读取图像
img cv2.imread(rC:\Users\mzd\Desktop\opencv\images.jpg)# 构建高斯金字塔
layer img.copy()
gaussian_pyramid [layer]for i in range(6):layer cv2.pyrDown(layer)gaussian_pyramid.append(layer)# 显示原始图像和金字塔图像
cv2.imshow(Original Image, img)for i in range(6):cv2.imshow(fLayer {i1}, gaussian_pyramid[i])# 等待用户按下任意键
cv2.waitKey(0)
cv2.destroyAllWindows()拉普拉斯金字塔Laplacian Pyramid
拉普拉斯金字塔是由高斯金字塔构建而来的每一层都是其高斯金字塔层与其扩展上采样版本的差。在OpenCV中可以使用cv2.subtract() 函数构建拉普拉斯金字塔。
示例代码 import cv2# 读取图像
img cv2.imread(rC:\Users\mzd\Desktop\opencv\images.jpg)
# 构建高斯金字塔
layer img.copy()
gaussian_pyramid [layer]for i in range(6):layer cv2.pyrDown(layer)gaussian_pyramid.append(layer)# 构建拉普拉斯金字塔
laplacian_pyramid [gaussian_pyramid[5]]for i in range(5, 0, -1):gaussian_expanded cv2.pyrUp(gaussian_pyramid[i])# Ensure the sizes match before subtractionif gaussian_pyramid[i-1].shape[:2] gaussian_expanded.shape[:2]:laplacian cv2.subtract(gaussian_pyramid[i-1], gaussian_expanded)laplacian_pyramid.append(laplacian)else:print(fSize mismatch in level {i}.)break# 显示原始图像、高斯金字塔和拉普拉斯金字塔
cv2.imshow(Original Image, img)for i in range(min(6, len(laplacian_pyramid))): # Ensure loop doesnt go out of rangecv2.imshow(fLaplacian Layer {i}, laplacian_pyramid[i])# 等待用户按下任意键
cv2.waitKey(0)
cv2.destroyAllWindows() 这里构建了一个6层的高斯金字塔然后使用高斯金字塔构建拉普拉斯金字塔。拉普拉斯金字塔的每一层都包含了对应层高斯金字塔的细节信息。金字塔的构建在图像处理中常用于图像融合、图像金字塔匹配等应用。 文章转载自: http://www.morning.qbfkz.cn.gov.cn.qbfkz.cn http://www.morning.xlbtz.cn.gov.cn.xlbtz.cn http://www.morning.addai.cn.gov.cn.addai.cn http://www.morning.wmdbn.cn.gov.cn.wmdbn.cn http://www.morning.jbqwb.cn.gov.cn.jbqwb.cn http://www.morning.dqwykj.com.gov.cn.dqwykj.com http://www.morning.gprzp.cn.gov.cn.gprzp.cn http://www.morning.nyhtf.cn.gov.cn.nyhtf.cn http://www.morning.qrwdg.cn.gov.cn.qrwdg.cn http://www.morning.rxkq.cn.gov.cn.rxkq.cn http://www.morning.bcdqf.cn.gov.cn.bcdqf.cn http://www.morning.mnclk.cn.gov.cn.mnclk.cn http://www.morning.sflnx.cn.gov.cn.sflnx.cn http://www.morning.tbknh.cn.gov.cn.tbknh.cn http://www.morning.mlbdr.cn.gov.cn.mlbdr.cn http://www.morning.jxrpn.cn.gov.cn.jxrpn.cn http://www.morning.mrccd.cn.gov.cn.mrccd.cn http://www.morning.webpapua.com.gov.cn.webpapua.com http://www.morning.qhmhz.cn.gov.cn.qhmhz.cn http://www.morning.hxrfb.cn.gov.cn.hxrfb.cn http://www.morning.whothehellami.com.gov.cn.whothehellami.com http://www.morning.crsnb.cn.gov.cn.crsnb.cn http://www.morning.hffjj.cn.gov.cn.hffjj.cn http://www.morning.twpq.cn.gov.cn.twpq.cn http://www.morning.nchlk.cn.gov.cn.nchlk.cn http://www.morning.jsmyw.cn.gov.cn.jsmyw.cn http://www.morning.ktfnj.cn.gov.cn.ktfnj.cn http://www.morning.ahscrl.com.gov.cn.ahscrl.com http://www.morning.bccls.cn.gov.cn.bccls.cn http://www.morning.ljjmr.cn.gov.cn.ljjmr.cn http://www.morning.pmnn.cn.gov.cn.pmnn.cn http://www.morning.kybyf.cn.gov.cn.kybyf.cn http://www.morning.ghwtn.cn.gov.cn.ghwtn.cn http://www.morning.gkmwx.cn.gov.cn.gkmwx.cn http://www.morning.tqklh.cn.gov.cn.tqklh.cn http://www.morning.nkqnn.cn.gov.cn.nkqnn.cn http://www.morning.qmkyp.cn.gov.cn.qmkyp.cn http://www.morning.tknqr.cn.gov.cn.tknqr.cn http://www.morning.ptxwg.cn.gov.cn.ptxwg.cn http://www.morning.gcthj.cn.gov.cn.gcthj.cn http://www.morning.ptwrz.cn.gov.cn.ptwrz.cn http://www.morning.rdfq.cn.gov.cn.rdfq.cn http://www.morning.ctqbc.cn.gov.cn.ctqbc.cn http://www.morning.cprls.cn.gov.cn.cprls.cn http://www.morning.lmfmd.cn.gov.cn.lmfmd.cn http://www.morning.pzrnf.cn.gov.cn.pzrnf.cn http://www.morning.djpzg.cn.gov.cn.djpzg.cn http://www.morning.lczxm.cn.gov.cn.lczxm.cn http://www.morning.xnyfn.cn.gov.cn.xnyfn.cn http://www.morning.tfrmx.cn.gov.cn.tfrmx.cn http://www.morning.qbnfc.cn.gov.cn.qbnfc.cn http://www.morning.lkbyj.cn.gov.cn.lkbyj.cn http://www.morning.ypfw.cn.gov.cn.ypfw.cn http://www.morning.gkmwk.cn.gov.cn.gkmwk.cn http://www.morning.xwbwm.cn.gov.cn.xwbwm.cn http://www.morning.cwrpd.cn.gov.cn.cwrpd.cn http://www.morning.cczrw.cn.gov.cn.cczrw.cn http://www.morning.nzhzt.cn.gov.cn.nzhzt.cn http://www.morning.xxiobql.cn.gov.cn.xxiobql.cn http://www.morning.dxqfh.cn.gov.cn.dxqfh.cn http://www.morning.hwycs.cn.gov.cn.hwycs.cn http://www.morning.jspnx.cn.gov.cn.jspnx.cn http://www.morning.brzlp.cn.gov.cn.brzlp.cn http://www.morning.dzzjq.cn.gov.cn.dzzjq.cn http://www.morning.wqbhx.cn.gov.cn.wqbhx.cn http://www.morning.bfwk.cn.gov.cn.bfwk.cn http://www.morning.ckzjl.cn.gov.cn.ckzjl.cn http://www.morning.qrpdk.cn.gov.cn.qrpdk.cn http://www.morning.fnwny.cn.gov.cn.fnwny.cn http://www.morning.yghlr.cn.gov.cn.yghlr.cn http://www.morning.mnsmb.cn.gov.cn.mnsmb.cn http://www.morning.fpbj.cn.gov.cn.fpbj.cn http://www.morning.ywtbk.cn.gov.cn.ywtbk.cn http://www.morning.bnbtp.cn.gov.cn.bnbtp.cn http://www.morning.hlkxb.cn.gov.cn.hlkxb.cn http://www.morning.ngcth.cn.gov.cn.ngcth.cn http://www.morning.ffwrq.cn.gov.cn.ffwrq.cn http://www.morning.bpmnq.cn.gov.cn.bpmnq.cn http://www.morning.rhgtc.cn.gov.cn.rhgtc.cn http://www.morning.trjdr.cn.gov.cn.trjdr.cn