-
Notifications
You must be signed in to change notification settings - Fork 5
/
histdissimilarity.m
46 lines (44 loc) · 1.3 KB
/
histdissimilarity.m
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
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
%% HISTDISSIMILARITY - Dissimilarity feature derived from (co)occurrence matrices.
%
%% Description
% Calculate the dissimilarity feature defined in [HSD73] from (co)occurrence
% matrices.
%
% The local dissimilarity |D| is calculated as [ST99]:
%
% * GLCM case - with $P_{ij}$ the joint probability of the greylevel pair
% $(i,j)$ : $D = \sum_{i,j} P_{ij} \cdot |i-j|$
% * GLSDV case - with $P_d$ the probability of the greylevel difference
% $d=i-j$ : $D = \sum_d P_d \cdot |d|$
%
%% Syntax
% D = HISTDISSIMILARITY(Pij, i, j);
% D = HISTDISSIMILARITY(Pd, d);
%
%% References
% See |HISTCONTRAST|.
%
%% See also
% Related:
% <HISTCONTRAST.html |HISTCONTRAST|>,
% <HISTENERGY.html |HISTENERGY|>,
% <HISTHOMOGENEITY.html |HISTHOMOGENEITY|>,
% <HISTVARIANCE.html |HISTVARIANCE|>,
% <HISTENTROPY2.html |HISTENTROPY2|>,
% <HISTENTROPY10.html |HISTENTROPY10|>,
% <HISTMAXIMUM.html |HISTMAXIMUM|>,
% <HISTMEAN.html |HISTMEAN|>,
% <HISTIDIFFERENCE.html |HISTIDIFFERENCE|>,
% <HISTCORRELATION.html |HISTCORRELATION|>,
% <LOCALGLCM2D.html |LOCALGLCM2D|>,
% <LOCALGLOV2D.html |LOCALGLOV2D|>,
% <LOCALGLSDV2D.html |LOCALGLSDV2D|>.
%% Function implementation
function D = histdissimilarity(pIJ,I,varargin)
D = I;
if nargin>2
D = D - varargin{1};
end;
D = abs(D);
D = sum (pIJ(:) .* D(:));
end % end of histdissimilarity