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

5 views (last 30 days)
Diah Junaidi on 29 Jul 2019
Edited: Diah Junaidi on 29 Jul 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');
% 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: Diah Junaidi on 29 Jul 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? :(

KSSV on 29 Jul 2019
% resize1= imresize(citraReferensi,[256 360], 'bilinear');
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)
Diah Junaidi on 29 Jul 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);