Calculate Histogram deviation or MDMF

조회 수: 5 (최근 30일)
Renjith V Ravi
Renjith V Ravi 2017년 2월 13일
편집: Renjith V Ravi 2017년 2월 13일
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

답변 (1개)

Image Analyst
Image Analyst 2017년 2월 13일
The Mathworks does not want us discussing encryption algorithms on their web site.
  댓글 수: 1
Renjith V Ravi
Renjith V Ravi 2017년 2월 13일
편집: Renjith V Ravi 2017년 2월 13일
I have edited the question.Kindly help me

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

Community Treasure Hunt

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

Start Hunting!

Translated by