拉普拉斯金字塔后的重建图像与原始图像不同 [英] Reconstructed Image after Laplacian Pyramid Not the same as original image
问题描述
我正在将RGB图像转换为YCbCr,然后想要计算相同的拉普拉斯金字塔。在颜色转换之后,我正在试验OpenCV的图像金字塔教程中的代码,以找到图像的拉普拉斯金字塔,然后重建原始图像。但是,如果我将代码中的级别数增加到更高的数字(例如10),则重建的图像(转换回RGB后)与原始图像看起来不一样(图像看起来模糊 - 请参见下面的链接确切的图像)。我不确定为什么会这样。是否会在级别增加或代码中出现任何问题时发生?
I am converting an RGB image into YCbCr and then want to compute the laplacian pyramid for the same. After color conversion, I am experimenting with the code give on the Image Pyramid tutorial of OpenCV to find the Laplacian pyramid of an image and then reconstruct the original image. However, if I increase the number of levels in my code to a higher number, say 10, then the reconstructed image(after conversion back to RGB) does not look the same as the original image(image looks blurred - please see below link for the exact image). I am not sure why this is happening. Is it suppose to happen when the levels increase or is there anything wrong in the code?
frame = cv2.cvtColor(frame_RGB, cv2.COLOR_BGR2YCR_CB)
height = 10
Gauss = frame.copy()
gpA = [Gauss]
for i in xrange(height):
Gauss = cv2.pyrDown(Gauss)
gpA.append(Gauss)
lbImage = [gpA[height-1]]
for j in xrange(height-1,0,-1):
GE = cv2.pyrUp(gpA[j])
L = cv2.subtract(gpA[j-1],GE)
lbImage.append(L)
ls_ = lbImage[0]
for j in range(1,height,1):
ls_ = cv2.pyrUp(ls_)
ls_ = cv2.add(ls_,lbImage[j])
ls_ = cv2.cvtColor(ls_, cv2.COLOR_YCR_CB2BGR)
cv2.imshow("Pyramid reconstructed Image",ls_)
cv2.waitKey(0)
作为参考,请参阅重建图像和原始图像。
For reference, please see the reconstructed image and the original image.
推荐答案
pyrDown模糊图像并对其进行下采样,丢失一些信息。保存的金字塔等级( gpA []
此处)包含越来越小的图像矩阵,但不保留被拒绝的信息详细信息(高频信息)。
pyrDown blurs an image and downsamples it, loosing some information. Saved pyramid levels (gpA[]
here) contain smaller and smaller image matrices, but don't keep rejected information details (high-frequency ones).
所以重建的图像无法显示所有原始细节
So reconstructed image cannot show all original details
来自教程:
注意:当我们缩小图片大小时,我们实际上会丢失图片信息。
这篇关于拉普拉斯金字塔后的重建图像与原始图像不同的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!