Error using psnr function

I used [peaksnr, snr] = psnr(B, A) wherein A is a binary image and B, the same image but a weiner2 function applied to it.
An error then is outputted
Error using psnr
Expected input number 1, A, to be one of these types:
uint8, uint16, int16, single, double
Instead its type was logical.
Error in psnr>checkImages (line 71)
validateattributes(A,validImageTypes,{'nonsparse'},mfilename,'A',1);
Error in psnr (line 39)
checkImages(A,ref);

回答 (1 件)

Image Analyst
Image Analyst 2017 年 9 月 21 日

0 投票

So? Just cast it to one of those data types like it suggested.
[peaksnr, snr] = psnr(double(B), double(A))

2 件のコメント

Jemela Llanes
Jemela Llanes 2017 年 9 月 22 日
編集済み: Jemela Llanes 2017 年 9 月 22 日
Thank you. It worked and as I try it on other formats, the values of PSNR changes. Is there any basis on which format should I use?
I'm using PSNR to calculate how much an image improved after applying a wiener2 noise removal filter. Is it wise to use this method for this purpose?
Image Analyst
Image Analyst 2017 年 9 月 22 日
I think PSNR is usually used to measure compression/decompression accuracy but I suppose you could use it. I think immse() or computing MAD (mean absolute difference) would be better.

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

タグ

質問済み:

2017 年 9 月 21 日

コメント済み:

2017 年 9 月 22 日

Community Treasure Hunt

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

Start Hunting!

Translated by