필터 지우기
필터 지우기

Histogram deviation or MDMF

조회 수: 1 (최근 30일)
Renjith V Ravi
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
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 to identify which code is correct according to the theoretical concepts

답변 (0개)

카테고리

Help CenterFile Exchange에서 Histograms에 대해 자세히 알아보기

Community Treasure Hunt

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

Start Hunting!

Translated by