Save SSIM index output

조회 수: 2 (최근 30일)
Angela
Angela 2018년 9월 15일
댓글: Image Analyst 2018년 9월 15일
I have 2 images (A,B) that i want to compare using the SSIM Index. I am using the command
[ssimval, ssimmap] = ssim(A,B);
imshow(ssimmap,[])
When i plot ssimmap i can see the different structures. When i save the ssimmap and then read the image:
imwrite(ssimmap,'test.jp2','Mode','lossless')
NewImage=imread('test.jp2')
When i plot 'NewImage' it looks all flat, it is different than 'ssimmap'. Is there something different about 'ssimmap' that it has to be saved in a special way? I want to be able to save ssimmap as an output file.

채택된 답변

KALYAN ACHARJYA
KALYAN ACHARJYA 2018년 9월 15일
%Try
[ssimval, ssimmap]=ssim(A,B);
imshow(ssimmap,[]);
saveas(gcf,'test.jpg');
NewImage=imread('test.jpg');
  댓글 수: 2
Angela
Angela 2018년 9월 15일
Thank you! It works really well. The only problem is the 'NewImage' has an added white border around it (the ssimmap does not have that), do you know if this is a feature of the 'saveas' or it can be removed? I usually use imwrite and i never have this issue. Thank you again.
Image Analyst
Image Analyst 2018년 9월 15일
saveas() saves the whole figure. Use imwrite to save just the image
imwrite(ssimmap, 'ssimmap.png');

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

추가 답변 (0개)

Community Treasure Hunt

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

Start Hunting!

Translated by