You are here : matlabImage Processingssim

ssim() - Image Processing

ssimval = ssim(A,ref) computes
the Structural Similarity Index (SSIM) value for image A using ref as
the reference image. example[ssimval,ssimmap]
= ssim(A,ref) returns
the local SSIM value for each pixel in A. ___ = ssim(__,Name,Value,...) computes
the SSIM, using name-value pairs to control aspects of the computation.
Parameter names can be abbreviated.


Syntax

ssimval = ssim(A,ref)[ssimval,ssimmap]
= ssim(A,ref) example___ = ssim(__,Name,Value,...)


Example

Calculate Structural Similarity Index (SSIM)Open This Example
Read an image into the workspace. Create another version of the image, applying a blurring filter. Display both images.ref = imread('pout.tif');
H = fspecial('Gaussian',[11 11],1.5);
A = imfilter(ref,H,'replicate');

subplot(1,2,1); imshow(ref); title('Reference Image');
subplot(1,2,2); imshow(A);   title('Blurred Image');

Calculate the global SSIM value for the image and local SSIM values for each pixel. Return the global SSIM value and display the local SSIM value map.[ssimval, ssimmap] = ssim(A,ref);

fprintf('The SSIM value is %0.4f.\n',ssimval);

figure, imshow(ssimmap,[]);
title(sprintf('ssim Index Map - Mean ssim Value is %0.4f',ssimval));
The SSIM value is 0.9407.

Related ExamplesCompare Image Quality at Various Compression Levels


Output / Return Value


Limitations


Alternatives / See Also


Reference