Effacer les filtres
Effacer les filtres

Calculate Histogram deviation or MDMF

5 vues (au cours des 30 derniers jours)
Renjith V Ravi
Renjith V Ravi le 13 Fév 2017
Modifié(e) : Renjith V Ravi le 13 Fév 2017
I am trying to calculate the histogram deviation(H.D) or Maximum Deviation Measuring Factor(M.D.M.F) as mentioned in
and
Two coding,I have done.one is
clear all
close all
clc
plain = imread('lena.bmp');% Read the input image
[M N] = size(plain);
r = uint8(randi([0,256],M,N)); % Generate a random matrix for encryption
cipher = bitxor(plain,r); % Encryption
% x = double(plain);
% y = double(cipher);
x = plain;
y = cipher;
x1 = imhist(x);
y1 = imhist(y);
%then calculate the difference between the two
diff = abs(x1-y1);
%then calculate D as follows
D1 = 0;
for i = 2:255
D1 = D1+diff(i);
end;
D2 = (diff(1)+diff(256))/2;
MDMF = D1+D2/(M*N)
and the other is
clear all
close all
clc
plain = imread('lena.bmp');% Read the input image
[M N] = size(plain);
r = uint8(randi([0,256],M,N)); % Generate a random matrix for encryption
cipher = bitxor(plain,r); % Encryption
% x = double(plain);
% y = double(cipher);
x = plain;
y = cipher;
hi = imhist(x);
hr = imhist(y);
subplot(211)
imhist(x);
title('Histogram of Original Image')
subplot(212)
imhist(y);
title('Histogram of Encrypted Image')
diff = imabsdiff(hi,hr);
% z = abs(hi-hr);
d = ((diff(1)+diff(256))/2);
d1 = sum(diff(2:255));
histogram_deviation = (d+d1)/(256*256)
Please help me identify which code is correct according to the theoretical concepts

Réponses (1)

Image Analyst
Image Analyst le 13 Fév 2017
The Mathworks does not want us discussing encryption algorithms on their web site.
  1 commentaire
Renjith V Ravi
Renjith V Ravi le 13 Fév 2017
Modifié(e) : Renjith V Ravi le 13 Fév 2017
I have edited the question.Kindly help me

Connectez-vous pour commenter.

Community Treasure Hunt

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

Start Hunting!

Translated by