display image similarity using pie and bar chart

1 visualización (últimos 30 días)
nat larsey
nat larsey el 28 de Mayo de 2020
Comentada: nat larsey el 1 de Jun. de 2020
Hi guys, i want to know whether it is possible to display the similarities between 2 or more images using pie chart and bar chart in percentages.

Respuesta aceptada

Subhadeep Koley
Subhadeep Koley el 28 de Mayo de 2020
I have used the ssim function to measure the similarity between to images. ssim metric value lies in the range of [0, 1]. Higher ssim value represents higher similarity. Therefore, I have used 1-ssimVal to caculate the dissimilarity. Refer the code below,
close all; clc;
% Read the original image
img = imread('cameraman.tif');
% Adding noise in the original image for demo
noisyImg = imnoise(img, 'gaussian', 0, 0.05);
% Calculate Structural Similarity Index (SSIM)
ssimVal = ssim(img,noisyImg);
% (1-ssimVal) will give the dissimilarity
values = [ssimVal, (1-ssimVal)];
% Display results
figure('units', 'normalized', 'outerposition', [0 0 1 1])
subplot(2, 2, 1)
imshow(img)
title('Original image')
subplot(2, 2, 2)
imshow(noisyImg)
title('Noisy image')
subplot(2, 2, 3)
pie(values)
labels = {'Similarity(%)', 'Dissimilarity(%)'};
legend(labels, 'Location', 'bestoutside')
title('Similarity pie chart')
subplot(2, 2, 4)
xValues = categorical({'Similarity(%)', 'Dissimilarity(%)'});
yValues = [ssimVal (1-ssimVal)].*100;
han = bar(xValues, yValues);
xtips1 = han(1).XEndPoints;
ytips1 = han(1).YEndPoints;
labels1 = string(han(1).YData);
text(xtips1, ytips1, labels1, 'HorizontalAlignment', 'center',...
'VerticalAlignment', 'bottom')
title('Similarity bar chart')
Hope this helps!
  2 comentarios
Subhadeep Koley
Subhadeep Koley el 28 de Mayo de 2020
@ nat larsey It is not clear what you exactly meant by 'compare'. SSIM compare how visually similar two images are. You want something like Cross Correlation metric between those images?
nat larsey
nat larsey el 1 de Jun. de 2020
yes sir

Iniciar sesión para comentar.

Más respuestas (0)

Community Treasure Hunt

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

Start Hunting!

Translated by