Skip to content

Commit

Permalink
Fix error in city block distance metric
Browse files Browse the repository at this point in the history
  • Loading branch information
petercorke committed Apr 9, 2017
1 parent ba5b0db commit 9f481e7
Showing 1 changed file with 6 additions and 3 deletions.
9 changes: 6 additions & 3 deletions distancexform.m
Original file line number Diff line number Diff line change
Expand Up @@ -82,11 +82,14 @@

switch opt.metric
case 'cityblock'
m = ones(3,3);
m(2,2) = 0;
m = [ inf 1 inf
1 0 1
inf 1 inf ];
case 'euclidean'
r2 = sqrt(2);
m = [r2 1 r2; 1 0 1; r2 1 r2];
m = [ r2 1 r2
1 0 1
r2 1 r2 ];
otherwise
error('unknown distance metric');
end
Expand Down

0 comments on commit 9f481e7

Please sign in to comment.