@@ -49,7 +49,7 @@ EIGEN_DEVICE_FUNC EIGEN_ALWAYS_INLINE void Distance(const T* f, T* d, int* v,
49
49
// compute horizontal position of intersection between the parabola from
50
50
// q and the current lowest parabola
51
51
s = (f[q] - f[v[k]]) / static_cast <T>(2 * (q - v[k])) +
52
- static_cast <T>((q + v[k]) / 2 );
52
+ static_cast <T>((q + v[k]) / 2.0 );
53
53
} while (s <= z[k]);
54
54
k++;
55
55
v[k] = q;
@@ -97,6 +97,9 @@ EIGEN_DEVICE_FUNC EIGEN_ALWAYS_INLINE void EuclideanDistanceTransformSample(
97
97
Distance<T>(f, d, vw, zw, width);
98
98
for (int j = 0 ; j < width; j++) {
99
99
int index = GET_INDEX (i, j, k, c);
100
+ if (Eigen::numext::isinf (d[j])) {
101
+ d[j] = Eigen::NumTraits<T>::highest ();
102
+ }
100
103
output[index ] = d[j];
101
104
}
102
105
}
@@ -108,6 +111,9 @@ EIGEN_DEVICE_FUNC EIGEN_ALWAYS_INLINE void EuclideanDistanceTransformSample(
108
111
Distance<T>(f, d, vh, zh, height);
109
112
for (int i = 0 ; i < height; i++) {
110
113
int index = GET_INDEX (i, j, k, c);
114
+ if (Eigen::numext::isinf (d[i])) {
115
+ d[i] = Eigen::NumTraits<T>::highest ();
116
+ }
111
117
output[index ] = Eigen::numext::sqrt (d[i]);
112
118
}
113
119
}
0 commit comments