How to implement the following equations in image encryption

조회 수: 2 (최근 30일)
Renjith V Ravi
Renjith V Ravi 2016년 12월 29일
댓글: Hina Naz 2021년 6월 15일
Upto finding D(i,j),I have found below
clear all
close all
clc
im1 = imread('lena.bmp');% Read the input image
im2 = im1;
im2(10,10) = 255; % im2 is the image with one pixel difference
[M N] = size(im1);
r = uint8(randi([0,256],h,w)); % Generate a random matrix for encryption
C1 = bitxor(im1,r); % Encryption-1
% imdec = bitxor(xored,r);
C2 = bitxor(im2,r); % Encryption-2
% find D(i,j)
for i=1:M
for j=1:N
if C1(i,j)== C2(i,j)
D(i,j) =0;
else
D(i,j) =1;
end
end
end
D = uint8(D); % change D to uint8 format
how to find the NPCR and UCAI as shown below
  댓글 수: 1
Hina Naz
Hina Naz 2021년 6월 15일
hi, did you complete that code to implement this equation for encryption?

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

채택된 답변

Walter Roberson
Walter Roberson 2016년 12월 29일
  댓글 수: 2
Renjith V Ravi
Renjith V Ravi 2016년 12월 29일
Yes,I have tried this already.But I got wrong answer
Walter Roberson
Walter Roberson 2016년 12월 29일
NPCR = mean(D(:)) * 100;
But watch out: your code expects the image to be grayscale, which might not be true for lena.bmp

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

추가 답변 (0개)

카테고리

Help CenterFile Exchange에서 Encryption / Cryptography에 대해 자세히 알아보기

Community Treasure Hunt

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

Start Hunting!

Translated by