フィルターのクリア

Can u solve this error?

2 ビュー (過去 30 日間)
Sanjeeb Behera
Sanjeeb Behera 2016 年 9 月 20 日
回答済み: Image Analyst 2016 年 9 月 20 日
n=size(I);
M=n(1);
N=n(2);
MSE = sum(sum((I-II).^2.0))/(M*N);
PSNR = 10*log10(256*256/MSE);
fprintf('\nMSE: %7.2f', MSE);
fprintf('\nPSNR: %9.7f dB', PSNR);
Here i am calculating the PSNR and MSE of I and II but it gives error
Integers can only be combined with integers of the same class, or scalar doubles.
Error in ==> Spatial_thesis at 58
MSE = sum(sum((I-II).^2.0))/(M*N);
I have taken
I=uint8(X);
II = logical(I8)*128+logical(I7)*64+logical(I6)*32+logical(I5)*16+logical(I4)*8+logical(I3)*4+logical(I2)*2+logical(I1);
  2 件のコメント
mbonus
mbonus 2016 年 9 月 20 日
編集済み: mbonus 2016 年 9 月 20 日
type whos for each variable and compare the types
Geoff Hayes
Geoff Hayes 2016 年 9 月 20 日
Sanjeeb - how are I and II initialized?

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

回答 (1 件)

Image Analyst
Image Analyst 2016 年 9 月 20 日
Use the built-in functions psnr() and immse(). Or else see my attached demo, or cast both I and II to double:
I = double(I);
II = double(II);

Community Treasure Hunt

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

Start Hunting!

Translated by