Effacer les filtres
Effacer les filtres

I wanna perform RMSE & SSIM but I cannot set same size of 2 image. Need your help :(

3 vues (au cours des 30 derniers jours)
Diah Junaidi
Diah Junaidi le 29 Juil 2019
Modifié(e) : Diah Junaidi le 29 Juil 2019
I wanna calculate RMSE and SSIM in these 2 images (I attached them):
I have no idea what should I do again to force them into same size.... I already perform imresize, size, and even row col set condition.... PLEASE HELP ME :(
A=imread('D:\DIAH\[MATLAB]cv1-fingerspelling-recognition-master\cv1-fingerspelling-recognition-master\Hasil Percobaan Standard\Hasil Citra Ground Truth_1_1.jpg');
% resize1= imresize(citraReferensi,[256 360], 'bilinear');
B=imread('D:\DIAH\[MATLAB]cv1-fingerspelling-recognition-master\cv1-fingerspelling-recognition-master\Hasil Percobaan HSV\png2jpg\Hasil Citra HSV_1a.jpg');
% resize2= imresize(citraEnhance,[256 360], 'bilinear');
% rmse = sqrt(immse(B, A));
% [ssimval, ssimmap] = ssim(resize2,resize1);
% fprintf('The SSIM value is %0.4f.\n',ssimval);
% fprintf('The RMSE value is %0.4f.\n',rmse);
figure,
imshowpair(A,B)
dimensi1=size(resize1);
dimensi2=size(resize2);
% fprintf('Dimension1 value is %0.4f.\n',dimensi1);
% fprintf('Dimension2 value is %0.4f.\n',dimensi2)B;
% Get size of existing image A.
[rowsA, colsA, numberOfColorChannelsA] = size(A);
% Get size of existing image B.
[rowsB, colsB, numberOfColorChannelsB] = size(B);
% See if lateral sizes match.
if rowsB ~= rowsA || colsA ~= colsB
% Size of B does not match A, so resize B to match A's size.
B = imresize(B, [rowsA colsA]);
end
Below is the result of the code:
  3 commentaires
Walter Roberson
Walter Roberson le 29 Juil 2019
Do they have the same number of color channels?
Diah Junaidi
Diah Junaidi le 29 Juil 2019
yeah, both of them in binary image sir but they surely different so that's why I asked that question. Is it possible to perform size to equal or not? :(

Connectez-vous pour commenter.

Réponses (1)

KSSV
KSSV le 29 Juil 2019
A=imread('Hasil Citra Ground Truth_1_1.jpg');
% resize1= imresize(citraReferensi,[256 360], 'bilinear');
B=imread('Hasil Citra HSV_1a.jpg');
B = rgb2gray(B) ;
% resize2= imresize(citraEnhance,[256 360], 'bilinear');
% rmse = sqrt(immse(B, A));
% [ssimval, ssimmap] = ssim(resize2,resize1);
% fprintf('The SSIM value is %0.4f.\n',ssimval);
% fprintf('The RMSE value is %0.4f.\n',rmse);
figure,
imshowpair(A,B)
[nx1,ny1] = size(A) ;
[nx2,ny2] = size(B) ;
nx = max(nx1,nx2) ; ny = max(ny1,ny2) ;
A = imresize(A,[nx,ny]) ;
B = imresize(B,[nx,ny]) ;
figure
imshowpair(A,B)
  3 commentaires
KSSV
KSSV le 29 Juil 2019
What you did? What error you are getting?
Diah Junaidi
Diah Junaidi le 29 Juil 2019
I wanna perform this sir, but my 2 images are in different size so I stuck on it :(
% rmse = sqrt(immse(B, A));
% [ssimval, ssimmap] = ssim(resize2,resize1);
% fprintf('The SSIM value is %0.4f.\n',ssimval);
% fprintf('The RMSE value is %0.4f.\n',rmse);

Connectez-vous pour commenter.

Tags

Community Treasure Hunt

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

Start Hunting!

Translated by