필터 지우기
필터 지우기

How to find NPCR and UAIC values of an image

조회 수: 3 (최근 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 CenterFile Exchange에서 Images에 대해 자세히 알아보기

Community Treasure Hunt

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

Start Hunting!

Translated by