How to find NPCR and UAIC values of an image

2 ビュー (過去 30 日間)
Parveiz Lone
Parveiz Lone 2020 年 5 月 12 日
回答済み: Parveiz Lone 2021 年 11 月 25 日
How to find NPCR and UAIC values of an image

採用された回答

Parveiz Lone
Parveiz Lone 2021 年 11 月 25 日
%% 3. NCPR score and UACI values for image data
function [n1 n2 n3 u1 u2 u3]=npcr_uaci(A,B)
[M N C]=size(A);
[M N C]=size(B);
A=uint8(A);
B=uint8(B);
A255=double(A)/double(255);
B255=double(B)/double(255);
D_R=0;
D_G=0;
D_B=0;
%
C_R=0;
C_G=0;
C_B=0;
for i=1:M
for j=1:N
if A(i,j,1)~=B(i,j,1)
D_R=D_R+1;
C_R=C_R+abs(A255(i,j,1)-B255(i,j,1));
% C_R=C_R+abs(double(A(i,j,1))-double(B(i,j,1)))/double(255);%or
end
if A(i,j,2)~=B(i,j,2)
D_G=D_G+1;
C_G=C_G+abs(A255(i,j,2)-B255(i,j,2));
end
if A(i,j,3)~=B(i,j,3)
D_B=D_B+1;
C_B=C_B+abs(A255(i,j,3)-B255(i,j,3));
end
end
end
n1=D_R*100/(M*N);
n2=D_G*100/(M*N);
n3=D_B*100/(M*N);
u1=C_R*100/(M*N);
u2=C_G*100/(M*N);
u3=C_B*100/(M*N);
end

その他の回答 (0 件)

カテゴリ

Help Center および File ExchangeImages についてさらに検索

Community Treasure Hunt

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

Start Hunting!

Translated by