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

2 Ansichten (letzte 30 Tage)
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 Kommentare
Diah Junaidi
Diah Junaidi am 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? :(

Melden Sie sich an, um zu kommentieren.

Antworten (1)

KSSV
KSSV am 29 Jul. 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 Kommentare
Diah Junaidi
Diah Junaidi am 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);

Melden Sie sich an, um zu kommentieren.

Tags

Community Treasure Hunt

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

Start Hunting!

Translated by