Code covered by the BSD License  

Highlights from
Image Quality - Index Analysis GUI

image thumbnail

Image Quality - Index Analysis GUI

by

 

29 Apr 2013 (Updated )

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

ediff3d(x, y, ws, imselect, absval)
function [eds, edm, edmaps] = ediff3d(x, y, ws, imselect, absval)

% Focal Entropy Difference for 3D images/arrays (m*n*z)

% 27/01/2013     -  Version 1.0
% 21/02/2013     -  Version 2.0

% Author:           Aristidis D. Vaiopoulos

% Find dimensions
sizex = size(x);
sizey = size(y);
if ~isequal(sizex,sizey)
    error('Images must have equal dimensions.')
end
if nargin == 2
    ws = 9;
    imselect = 0;
    absval = 1;
end
if nargin == 3
    imselect = 0;
    absval = 1;
end
if nargin == 4
    absval = 1;
end
% Number of bands
nb = size(x,3);
% Preallocate mean eds
eds = zeros(nb,1);
% Entropy Difference
if imselect == 0
    if nargout == 3
        % Preallocate edmaps (memory voracious)
        edmaps = single(zeros(sizex));
        for b = 1:nb
            [eds(b), edmaps(:,:,b)] = ...
                entropydiff( x(:,:,b),y(:,:,b),ws,absval );
        end
    else
        for b = 1:nb
            eds(b) = entropydiff( x(:,:,b),y(:,:,b),ws,absval );
        end
    end
end
% Entropy of image X
if imselect == 1
    if nargout == 3
        % Preallocate edmaps (memory voracious)
        edmaps = single(zeros(sizex));
        for b = 1:nb
            [~,~,eds(b),edmaps(:,:,b)] = ...
                entropydiff( x(:,:,b),y(:,:,b),ws,absval );
        end
    else
        for b = 1:nb
            [~,~,eds(b)] = entropydiff( x(:,:,b),y(:,:,b),ws,absval );
        end
    end
end
% Entropy of image Y
if imselect == 2
    if nargout == 3
        % Preallocate edmaps (memory voracious)
        edmaps = single(zeros(sizex));
        for b = 1:nb
            [~,~,~,~,eds(b),edmaps(:,:,b)] = ...
                entropydiff( x(:,:,b),y(:,:,b),ws,absval );
        end
    else
        for b = 1:nb
            [~,~,~,~,eds(b)] = entropydiff( x(:,:,b),y(:,:,b),ws,absval );
        end
    end
end
% Average quality 
edm = mean(eds);

end

Contact us