How can I resolve the following error?
Show older comments
clc;
close all;
clear all;
ref=imread('blood.jpg');
I=rgb2gray(ref);
n=size(I);
A=imnoise(I,'speckle',0.04);
A1 = wiener2(A,[3 3]);
figure;
subplot(1,2,1),imshow(I);
title('Original Image');
subplot(1,2,2),imshow(A);
title('Noisy Image(Speckle)');
figure
imshow(A1);
title('Filtered Image');
M=n(1);
N=n(2);
MSE = sum(sum((ref-A).^2))/(M*N);
MSE1 = sum(sum((ref-A1).^2))/(M*N);
PSNR = 10*log10(256*256/MSE);
PSNR1 = 10*log10(256*256/MSE1);
fprintf('\nMSE: %0.2f ', MSE);
fprintf('\nPSNR: %0.2f dB', PSNR);
fprintf('\nMSE: %0.2f ', MSE1);
fprintf('\nPSNR: %0.2f dB', PSNR1);
message = sprintf('MSE for Noisy Image.\nThe mean square error is %.2f.\nThe PSNR = %.2f\n', MSE, PSNR);
msgbox(message);
message = sprintf('MSE for Filtered Image.\nThe mean square error is %.2f.\nThe PSNR = %.2f\n', MSE1, PSNR1);
msgbox(message);
%%%%%%%%%%%%%Error%%%%%%%%%%%%%%%%%%
Error using -
Matrix dimensions must agree.
Error in spckl (line 20)
MSE = sum(sum((ref-A).^2))/(M*N);
Accepted Answer
More Answers (0)
Categories
Find more on Time-Frequency Analysis in Help Center and File Exchange
Products
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!