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

조회 수: 1 (최근 30일)
Diah Junaidi
Diah Junaidi 2019년 7월 29일
편집: Diah Junaidi 2019년 7월 29일
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
Walter Roberson
Walter Roberson 2019년 7월 29일
Do they have the same number of color channels?
Diah Junaidi
Diah Junaidi 2019년 7월 29일
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? :(

댓글을 달려면 로그인하십시오.

답변 (1개)

KSSV
KSSV 2019년 7월 29일
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
KSSV
KSSV 2019년 7월 29일
What you did? What error you are getting?
Diah Junaidi
Diah Junaidi 2019년 7월 29일
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);

댓글을 달려면 로그인하십시오.

태그

Community Treasure Hunt

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

Start Hunting!

Translated by