MATLAB: NPCR Error

npcr error

For Image Quality Parameters I need to find NPCR for 2 images after encryption whose original image have 1 pixel difference. The code is:
% For Grayscale Jpeg Images
C=Cipher Image
C2c=Cipher Image after 1 Pixel difference in Original Image.
siz=M*M;
NPCR=0;
SSS=0;
for i=1:M
for j=1:M
if (C2(i,j)==C2c(i,j))
SSS=SSS;
else
SSS=SSS+1;
end
end
end
SSS=SSS/siz;
NPCR=SSS*100;
I get NPCR value=0.0015. Is my code not OK or the method for Cipher image. I should get a value around 99.67%
Suggest any solutions or error

Best Answer

The best encryption schemes would show no correlation between the encrypted versions of two original images that were nearly the same but not identical.