-
Notifications
You must be signed in to change notification settings - Fork 5
/
histidifference.m
54 lines (51 loc) · 1.38 KB
/
histidifference.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
47
48
49
50
51
52
53
54
%% HISTIDIFFERENCE - Inverse difference feature derived from (co)occurrence matrices.
%
%% Description
% Calculate the inverse difference feature defined in [HSD73] from (co)occurrence
% matrices.
%
% This feature measures the local inverse difference |D| in an image as [ST99]:
%
% * GLCM case - with $P_{ij}$ the joint probability of the greylevel pair
% $(i,j)$ :
% $$
% D = \sum_{i,j} \frac{P_{ij}}{(1+|i-j|)}
% $$
%
% * GLSDV case - with $P_d$ the probability of the greylevel difference
% $d=i-j$ :
% $$
% D = \sum_d \frac{P_d}{(1+|d|)}
% $$
%
%% Syntax
% D = HISTIDIFFERENCE(Pd, d);
% D = HISTIDIFFERENCE(Pij, i, j);
%
%% 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|>,
% <HISTDISSIMILARITY.html |HISTDISSIMILARITY|>,
% <HISTCORRELATION.html |HISTCORRELATION|>,
% <LOCALGLCM2D.html |LOCALGLCM2D|>,
% <LOCALGLOV2D.html |LOCALGLOV2D|>,
% <LOCALGLSDV2D.html |LOCALGLSDV2D|>.
%% Function implementation
function D = histidifference(pIJ,I,varargin)
D = I;
if nargin>2
D = D - varargin{1};
end;
D = 1 + abs(D);
D = sum (pIJ(:) ./ D(:));
end % end of histidifference