Why is the SSIM value quite low for two same images

12 views (last 30 days)
I have two images, taken back to back from a camera without disturbing the setup and keeping everything constant. But when I try to find out the SSIM value between the two images, it comes out to be 0.4609. I want to know what would be a reason for this.
I have attached the two images.
Thanks in advance.
  2 Comments
Ameer Hamza
Ameer Hamza on 16 Sep 2020
On my PC, I get 0.914 by exactly using the images you shared
Parth Deshpande
Parth Deshpande on 16 Sep 2020
When I tried doing the same using your code, I am also getting 0.9140. But when I use the code below, it gives me 0.4609
clc; % Clear the command window.
close all; % Close all figures (except those of imtool.)
imtool close all; % Close all imtool figures.
clear; % Erase all existing variables.
workspace; % Make sure the workspace panel is showing.
format long g;
format compact;
fontSize = 11;
Button_Image_Import = questdlg('What type of image would you like to import ?',...
'Image type?',...
'Dicom','Tiff or Jpeg','Matlab file','Tiff or Jpeg');
switch Button_Image_Import,
case 'Dicom',
[image_file, path_name] = uigetfile('*.dcm','Please select the dicom image you wish to import');
idealimage = double(dicomread([path_name image_file]));
case 'Tiff or Jpeg'
[image_file, path_name] = uigetfile({'*.tif; *.tiff; *.jpg; *.jpeg'},'Please select the jpeg or tiff image you wish to import');
idealimage = double(imread([path_name image_file]))
case 'Matlab file'
[image_file, path_name] = uigetfile('*.mat','Please select the Matlab file containing an image named "image"in you wish to load');
matstruct = load([path_name image_file])
idealimage = double(matstruct.image);
end
switch Button_Image_Import,
case 'Dicom',
[image_file, path_name] = uigetfile('*.dcm','Please select the dicom image you wish to import');
pretestimage = double(dicomread([path_name image_file]));
case 'Tiff or Jpeg'
[image_file, path_name] = uigetfile({'*.tif; *.tiff; *.jpg; *.jpeg'},'Please select the jpeg or tiff image you wish to import');
pretestimage = double(imread([path_name image_file]))
case 'Matlab file'
[image_file, path_name] = uigetfile('*.mat','Please select the Matlab file containing an image named "image"in you wish to load');
matstruct = load([path_name image_file])
pretestimage = double(matstruct.image);
end
[ssimval,ssimmap] = ssim(idealimage,pretestimage);
figure, imshow(ssimmap,[]);
title(['Local SSIM Map with Global SSIM Value: ', num2str(ssimval)])

Sign in to comment.

Accepted Answer

Ameer Hamza
Ameer Hamza on 16 Sep 2020
Edited: Ameer Hamza on 16 Sep 2020
The issue is that you are using double() to convert the image to double format. The correct function to use here is im2double(). double() just convert to double data type, whereas im2double() also scale image intensities between 0 and 1.
Change
idealimage = double(imread([path_name image_file]))
to
idealimage = im2double(imread([path_name image_file]))
and similarly at other locations.

More Answers (0)

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!