Calculate Histogram deviation or MDMF

5 visualizzazioni (ultimi 30 giorni)
Renjith V Ravi
Renjith V Ravi il 13 Feb 2017
Modificato: Renjith V Ravi il 13 Feb 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

Risposte (1)

Image Analyst
Image Analyst il 13 Feb 2017
The Mathworks does not want us discussing encryption algorithms on their web site.
  1 Commento
Renjith V Ravi
Renjith V Ravi il 13 Feb 2017
Modificato: Renjith V Ravi il 13 Feb 2017
I have edited the question.Kindly help me

Accedi per commentare.

Community Treasure Hunt

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

Start Hunting!

Translated by