To find the MSE value



%Let me explain with the same example.
%To the input image Iimg applied the 'Salt & Pepper noise' with the noise ratio of 20% and named as 'Nimg'.
%Now for the 'Nimg' i applied median filter and named as Mimg.
%Now i need to find the 'Mean Square Error' MSE comparison between Mimg and Nimg.


clear all
close all
clc;
Iimg=imread('moon.tif');
[r c]=size(  Iimg );
d=ndims( Iimg );
if d == 3
     Iimg =rgb2gray( Iimg );
end
Iimg=double( Iimg );
Iimg= Iimg /225;
Nimg=imnoise( Iimg ,'salt & pepper',0.2);
Mimg=medfilt2( Nimg ,[5 5]);
clc;
Diff= Nimg - Mimg ;
MSE= sum(sum(Diff.* Diff)) / (r * c);
fprintf('\n\nThe Mse value is:  %d',MSE1);
subplot(1,2,1);imshow( Nimg );title('Noised image');
subplot(1,2,2);imshow( Mimg );title('Denoised image');


RESULT:


The Mse value is:  2.521604e-002

i.e, MSE ~ 0.0252


Comments

  1. How u convert that Mse value?? Will u pls explain??

    ReplyDelete
    Replies
    1. MSE is an average of the squares of the difference between the actual observations and those predicted observations. MSE gives larger result values for larger errors and gives small result values for small errors.

      Delete
  2. Plz I need to calculate mse from SD how can I do it ?
    Mse= SD*SD/n?????
    Is this write or wrong?

    ReplyDelete
  3. How to make money with your phone - How to make money from
    One of the easiest things to do online, When we use the 1xbet Betway app, our customers are asked kadangpintar to deposit their first five dollars, and you will be หารายได้เสริม

    ReplyDelete

Post a Comment

Popular posts from this blog

Matlab code to get negative of an image

Vidicon Camera Tube