]> AND Private Git Repository - these_gilles.git/blob - THESE/codes/graphe/Ncut_9/compute_relation.m
Logo AND Algorithmique Numérique Distribuée

Private GIT Repository
modif finale lnivs + keywords
[these_gilles.git] / THESE / codes / graphe / Ncut_9 / compute_relation.m
1 function [W,distances] = compute_relation(data,scale_sig,order)
2 %
3 %      [W,distances] = compute_relation(data,scale_sig) 
4 %       Input: data= Feature_dimension x Num_data
5 %       ouput: W = pair-wise data similarity matrix
6 %              Dist = pair-wise Euclidean distance
7 %
8 %
9 % Jianbo Shi, 1997 
10
11
12 distances = zeros(length(data),length(data));
13 for j = 1:length(data),
14   distances(j,:) = (sqrt((data(1,:)-data(1,j)).^2 +...
15                 (data(2,:)-data(2,j)).^2));
16 end
17
18 % distances = X2distances(data');
19
20 if (~exist('scale_sig')),
21     scale_sig = 0.05*max(distances(:));
22 end
23
24 if (~exist('order')),
25   order = 2;
26 end
27
28 tmp = (distances/scale_sig).^order;
29
30 W = exp(-tmp);
31