To save each of sub-indices (luminance, contrast and structure) in SSIM

6 次查看(过去 30 天)
Hello,
I compare two dicom or nii data using sub-indices (luminance, contrast and structure) in SSIM.
I appreiciate if anyone let me get how to save each of sub-indices (luminance, contrast and structure) in SSIM seperatly.

回答(1 个)

DGM
DGM 2021-10-23
Unless you need something special, you should be able to do this with standard syntax for ssim(). Mind you, the SSIM is the mean of the elementwise product of three arrays. If you extract only the index of each component, you're losing information by taking the array means before taking the product. Whether that matters depends what you expect to do with this information.
A = imread('cameraman.tif');
B = imgaussfilt(A,1.5);
% get SSIM index and map
[S Sm] = ssim(B,A);
% get component indices and maps
[Sc(1) Scm(:,:,1)] = ssim(B,A,'exponent',[1 0 0]);
[Sc(2) Scm(:,:,2)] = ssim(B,A,'exponent',[0 1 0]);
[Sc(3) Scm(:,:,3)] = ssim(B,A,'exponent',[0 0 1]);
% combine component indices (approximates SSIM)
[S prod(Sc)]
ans = 1×2
0.7801 0.7648
% combine component maps and take mean (matches SSIM)
[S mean2(prod(Scm,3))]
ans = 1×2
0.7801 0.7801
If you need something different, just open ssim(), look at it, and write a version that does what you want.
  4 个评论
DGM
DGM 2021-11-4
If and when you find the answer has met your needs, you can accept it. That will move the thread to the "answered" queue, and hopefully make it more attractive to the next person with a similar question.

请先登录,再进行评论。

Community Treasure Hunt

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

Start Hunting!

Translated by