帧内预测帧与编码帧的PSNR [英] PSNR for intra predicted frame vs encoded frame

查看:98
本文介绍了帧内预测帧与编码帧的PSNR的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我必须对视频帧执行帧内预测编码并计算其PSNR.现在,我被要求采取相同的原始帧并对其进行编码,该帧包括执行DCT,量化,反量化和逆DCT.我必须计算编码帧的PSNR,并将其与帧内预测帧进行比较.

I have to perform Intra predicted coding on a video frame and calculate its PSNR. I am now asked to take the same original frame and encode it which consists of performing DCT, quantization, dequantization and inverse DCT. I have to calculate the PSNR of the encoded frame and compare it with the intra predicted frame.

对于帧内预测帧,我得到的值是53.37 db,对于编码帧,我得到的值是32.64 db.我应该使用直方图来分析编码图像的概率分布.两个帧的直方图看起来极为相似,所以我实际上应该寻找什么?

I got the values of 53.37 db for the intra predicted frame and 32.64 db for the encoded frame. I am supposed to analyze the probability distribution of the encoded image using the histogram. Histogram for both frames look extremely similar so what am I actually supposed to look for?

编辑

我计算PSNR的方法是采用原始帧和重建帧之间的差,然后使用PSNR公式.代码片段如下所示:

The way I am calculating the PSNR is taking the difference between the original frame and the reconstructed frame and then using the PSNR formula. Code snippet shown below:

errorFrame = orgFrame - reconstFrame;    
y = 10*log10(255*255/mean(mean((errorFrame.^2))));

帧内预测帧和重建帧的PSNR是否应为相同值?我已经上传了具有帧内预测的重构帧和没有帧内预测的重构帧的直方图

Should the PSNR of the intra predicted frame and the reconstructed frame be the same value? I have uploaded the histogram of the reconstructed frame with intra prediction and reconstructed frame without intra prediction

直方图看起来非常相似,为什么PSNR值如此不同?

The histrograms look extremely similar so why is the PSNR value so different?

推荐答案

PSNR在两个图像之间进行逐点比较.直方图捕获整个强度的整个分布.例如,如果您的图像是:

The PSNR does a point-by-point comparison between two images. The histograms capture the entire distribution of intensities as a whole. For example, if you had an image that was:

A = [0 255;
     255 0]; 

...另一个是:

B = [255 0; 
     0 255];

...,假设原始图片是

... and let's say original image was

C = [0 128; 
    128 0];. 

即使AB之间的直方图相同,但PSNR分别为9.06502.0344 dB.因此,我不会依赖直方图本身,因为它们只能捕获全局信息.从本地看.显然,您可以看到其中一个具有比另一个更高的质量.在您的直方图中,尽管直方图中的大多数bin看起来都是相等的,但是直方图不是空间感知的.换句话说,像素的空间关系未在直方图中捕获,就像您在我上面给出的示例中所看到的那样.假设您有15个像素,两个图像的强度均为80,但它们在每个图像中的位置可能完全不同.这样,您可能会获得与另一幅图像完全不同的外观图像,但是如果您计算每个强度的像素数量,只要每个强度的 counts 相等,则直方图将相等.

Even though the histograms between A and B are the same, the PSNRs are 9.0650 and 2.0344 dB respectively. As such, I wouldn't rely on the histograms themselves as they only capture global information. Look at it locally. You can obviously see one has higher quality than the other. In your histograms, though most of the bins of the histograms look equal, but histograms are not spatially aware. In other words, the spatial relationships of pixels are not captured in histograms, as you have seen with my example I gave above. You could have, say, 15 pixels having intensity 80 for both images, but they could be in completely different locations in each of the images. As such, you could have a completely different looking image in comparison to another, but if you counted the amount of pixels per intensity, as long as the counts per intensity are equal, the histograms will be equal.

您可以看到AC相似,因为其中一个只是另一个的灰色版本.但是,B相差很远,因为它具有C中存在暗像素的白色像素,而当C中存在灰度像素时的暗像素.尽管A和B之间的直方图相同,但是与C相比,它们之间的实际内容却大不相同.

You can see that A and C are similar in that one is simply the grayer version of the other. However, B is way off as it has white pixels where there are dark pixels in C, and dark pixels when there are gray pixels in C. Though the histograms between A and B are the same, the actual content between them are quite different compared to C.

我确实意识到您需要比较两个图像之间的直方图/概率分布,但是这个问题可能是有意提出的.尽管您可以看到强度分布相对相同,但是如果您分析两者之间的局部图像斑块,则可以肯定地看到一种质量比另一种质量差.老实说,从个人经验中回顾,您应该对PSNR有所了解.仅仅因为一个图像具有比另一个图像更高的PSNR并不一定意味着它的质量更高.实际上,有些图像的PSNR较低,但我认为它们的质量要比PSNR较高的图像更好.

I do realize that you need to compare the histograms / probability distributions between both of the images, but this question may have been asked on purpose. Though you can see the distribution of intensities is relatively the same, if you analyze local image patches between the two, you can definitely see that one is a lower quality than the other. To be honest, and recounting from personal experience, you should take PSNR with a grain of salt. Just because one image has a higher PSNR than the other doesn't necessarily mean that it is better quality. In fact, there have been images where they were lower PSNR, but I considered them to be better quality than one with higher PSNR.

因此,当您回答问题时,请确保您引用了我在这里说的所有内容.

As such, when you answer your question, make sure you reference everything that I've said here.

tl;dr:尽管直方图看起来相等,但直方图在空间上并不敏感.像素的空间关系未在直方图中捕获.这样,您可能会获得与另一幅图像完全不同的外观图像,但是如果您计算每个强度的像素数量,只要每个强度的 counts 相等,则直方图将相等.即使直方图不相等,PSNR也会发生逐点差异,这种(某种)捕获了像素的空间关系,从而解释了PSNR为何如此不同的原因.

tl;dr: Though the histograms look equal, histograms are not spatially aware. The spatial relationships of pixels are not captured in histograms. As such, you could have a completely different looking image in comparison to another, but if you counted the amount of pixels per intensity, as long as the counts per intensity are equal, the histograms will be equal. Even with the histograms being unequal, doing PSNR does a point-by-point difference, and this (sort of) captures the spatial relationships of pixels and thus explains why the PSNRs are quite different.

这篇关于帧内预测帧与编码帧的PSNR的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆