How to calculate PSNR of binary image

1 回表示 (過去 30 日間)
snake eyes
snake eyes 2011 年 8 月 23 日
コメント済み: DGM 2024 年 12 月 13 日
Please ,tell me the PSNR equation for binary image,whose pixel values are just 0 or 1 .
Thanks in advance.

回答 (1 件)

Pratik
Pratik 2024 年 12 月 12 日
Hi,
'psnr' function can be used to calculate the value given the original and reconstructed image.
Please refer to the following documentation of 'psnr' function for more information:
  1 件のコメント
DGM
DGM 2024 年 12 月 13 日
IPT psnr() does not accept logical inputs.
Admittedly, all logical images are "binarized", but not all "binarized" images are logical; however, in most contexts, it's reasonable to assume that binary image handling within MATLAB is done using logical arrays.
They could always be cast as double or any other class, but bear in mind that they must be cast and scaled.
inpict = imread('cameraman.tif');
a = inpict>127;
b = inpict>128;
% this works
psnr(im2double(a),im2double(b)) % cast and scaled
ans = 22.2430
% this is identical
psnr(im2uint8(a),im2uint8(b)) % cast and scaled
ans = 22.2430
% but if the inputs are not scaled to suit their class
% then the measure becomes class-dependent.
psnr(uint8(a),uint8(b)) % cast, but not scaled
ans = 70.3738
psnr(uint16(a),uint16(b)) % cast, but not scaled
ans = 118.5725

サインインしてコメントする。

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!

Translated by