-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathfuzzyEntropy.m
More file actions
26 lines (23 loc) · 836 Bytes
/
fuzzyEntropy.m
File metadata and controls
26 lines (23 loc) · 836 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
function entropy=fuzzyEntropy(x,h)
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
% INPUTS : 'x' is the fuzzy parameter vector
% 'h' is the histrogram of the image
% OUTPUT: 'entropy' is the Fuzzy Entropy of the image after fuzzy partition
% of the histogram 'h' by the fuzzy parameter vector 'x'
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
% Written by : Sujoy Paul, Jadavpur University, Kolkata %
% Email : paul.sujoy.ju@gmail.com %
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
entropy=0;
% x(x>255)=255;
x=[1 1 (x+1) 256 256];
for i=1:2:length(x)-3
U=trapmf(1:256,x(i:i+3));
P=U.*h;
P=P./sum(P);
P=P.*log(P);
P(isnan(P))=0;
entropy=entropy+sum(P);
end
entropy=-entropy;
%entropy=1/entropy;