|
40 | 40 | % Displays info on iterations. |
41 | 41 | % |
42 | 42 | % Example |
43 | | -% % computes distance function inside a complex particle |
| 43 | +% % computes distance function inside a complex particle |
44 | 44 | % mask = Image.read('circles.png'); |
45 | 45 | % marker = Image.false(size(mask)); |
46 | 46 | % marker(80, 80) = 1; |
47 | 47 | % % compute using quasi-enclidean weights |
48 | 48 | % dist = geodesicDistanceMap(marker, mask); |
49 | | -% figure; imshow(dist, []); |
50 | | -% colormap(jet); title('Quasi-euclidean distance'); |
51 | | -% % compute using integer weights, giving integer results |
52 | | -% dist34 = geodesicDistanceMap(marker, mask, int16([3 4])); |
53 | | -% figure; imshow(double(dist34)/3, [0 max(dist34(mask))/3]); |
54 | | -% colormap(jet); title('Borgefors 3-4 weights'); |
| 49 | +% figure; show(double2rgb(dist)); |
| 50 | +% title('Geodesic distance map'); |
55 | 51 | % |
| 52 | +% % compute the same distance map but using integer weights, giving |
| 53 | +% % integer results. |
| 54 | +% dist34 = geodesicDistanceMap(marker, mask, int16([3 4])); |
| 55 | +% % convert to double, taking into account values out of mask |
| 56 | +% dist34 = double(dist34) / 3; |
| 57 | +% dist34(~mask) = inf; |
| 58 | +% % display result |
| 59 | +% rgb = double2rgb(dist34); |
| 60 | +% figure; show(rgb); title('Geodesic distance map, integer weights'); |
56 | 61 | % |
57 | | -% % uses the examples from bwdist with different distances |
58 | | -% img = ones(255, 255); |
59 | | -% img(126, 126) = 0; |
60 | | -% res1 = geodesicDistanceMap(img); |
61 | | -% res2 = geodesicDistanceMap(img, [1 inf]); |
62 | | -% res3 = geodesicDistanceMap(img, [1 1]); |
63 | | -% res4 = geodesicDistanceMap(img, [1 1.5]); |
64 | | -% figure; |
65 | | -% subplot(221); subimage(mat2gray(res1)); |
66 | | -% hold on; imcontour(res1); title('quasi-euclidean'); |
67 | | -% subplot(222); subimage(mat2gray(res2)); |
68 | | -% hold on; imcontour(res2); title('city-block'); |
69 | | -% subplot(223); subimage(mat2gray(res3)); |
70 | | -% hold on; imcontour(res3); title('chessboard'); |
71 | | -% subplot(224); subimage(mat2gray(res4)); |
72 | | -% hold on; imcontour(res4); title('approx euclidean'); |
73 | 62 | % |
74 | 63 | % The function uses scanning algorithm. Each iteration consists in a |
75 | 64 | % sequence of a forward and a backward scan. Iterations stop when |
|
0 commit comments