Line | |
---|
1 | %dist Return distance between image points in homog. coor. in specified metric. |
---|
2 | % |
---|
3 | % d = dist(M1, M2, metric) |
---|
4 | % |
---|
5 | % Parameters: |
---|
6 | % metric .. x- and y-coordinates are associated with a single image point |
---|
7 | % 1 .. square root of sum of squares of x- and y-coordinates |
---|
8 | % 2 .. std of x- and y-coordinates |
---|
9 | % <=> equivalent to noise type 2 in noise_add |
---|
10 | |
---|
11 | function d = dist(M1, M2, metric) |
---|
12 | |
---|
13 | if nargin < 3, metric = 2; end |
---|
14 | |
---|
15 | switch metric, |
---|
16 | case 1, I = ~isnan(M1(1:3:end,:)) &~isnan(M2(1:3:end,:)); |
---|
17 | d = eucl_dist(M1, M2, I) / sum(sum(I)); |
---|
18 | case 2, D = normalize_cut(M1) - normalize_cut(M2); |
---|
19 | i = find(~isnan(D(1:2:end))); |
---|
20 | d = std([D(2*i-1) D(2*i)]); |
---|
21 | otherwise, error('dist: unknown metric'); |
---|
22 | end |
---|
Note: See
TracBrowser
for help on using the repository browser.