Code covered by the BSD License

# Image Quality - Index Analysis GUI

### Aristidis Vaiopoulos (view profile)

29 Apr 2013 (Updated )

This GUI measures the image quality/error between 2 or more images (original,test1/test2/.../testn).

entropydiff(x,y,ws,absval)
```function [ED, ED_map, Ex, Ex_map, Ey, Ey_map] = entropydiff(x,y,ws,absval)

% Local Entropy Difference of 2 images

% 04/12/2012    -  Version 1.0
% 27/01/2013    -  Version 2.0
% 21/02/2013    -  Version 3.0  / Absolute value option

% Author:           Aristidis D. Vaiopoulos
% Acknowledgement:  Mathworks MATLAB entropy function

% Warning: Calculations take place in 8bit imagery

% Build neighbors of entropyfilt
if nargin == 2
ws = ones(9);
absval = 1;
end
if nargin == 3 && length(ws) == 1
if rem(ws,2) == 0
disp(' ')
disp(['Warning: Cannot use specified window size (',...
num2str(ws),'), which is even.'])
disp(['Using window size of ', num2str(ws+1),' instead.'])
disp(' ')
ws = ws + 1;
end
ws = ones(ws);
absval = 1;
end
if nargin == 4 && length(ws) == 1
if rem(ws,2) == 0
disp(' ')
disp(['Warning: Cannot use specified window size (',...
num2str(ws),'), which is even.'])
disp(['Using window size of ', num2str(ws+1),' instead.'])
disp(' ')
ws = ws + 1;
end
ws = ones(ws);
end
% Call Matlab entropyfilt function to do the work
Ex_map = entropyfilt(x,ws);
Ey_map = entropyfilt(y,ws);
% Take absolute difference
if absval == 1
ED_map = abs(Ex_map - Ey_map);
else
ED_map = (Ex_map - Ey_map);
end
% Calculate Entropy from valid area
s = round(length(ws)/2);
ED = mean2( ED_map(s:end-s,s:end-s) );
Ex = mean2( Ex_map(s:end-s,s:end-s) );
Ey = mean2( Ey_map(s:end-s,s:end-s) );

end
```