Why is the SSIM value quite low for two same images

조회 수: 11 (최근 30일)
Parth Deshpande
Parth Deshpande 2020년 9월 16일
댓글: Ameer Hamza 2020년 9월 16일
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
Ameer Hamza
Ameer Hamza 2020년 9월 16일
On my PC, I get 0.914 by exactly using the images you shared
Parth Deshpande
Parth Deshpande 2020년 9월 16일
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)])

댓글을 달려면 로그인하십시오.

채택된 답변

Ameer Hamza
Ameer Hamza 2020년 9월 16일
편집: Ameer Hamza 2020년 9월 16일
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.
  댓글 수: 2
Parth Deshpande
Parth Deshpande 2020년 9월 16일
Thanks a lot for the correction!
Ameer Hamza
Ameer Hamza 2020년 9월 16일
I am glad to be of help!

댓글을 달려면 로그인하십시오.

추가 답변 (0개)

Community Treasure Hunt

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

Start Hunting!

Translated by