在轮廓图像上计算距离图的问题

Problems to compute a distance map on a contour image

是否可以在充满轮廓的图像上计算距离图?我曾经计算过图像上的距离图,这些图像以前使用 梯度幅度 过滤器处理过,效果很好,距离使用梯度获得的边界最远的点是黑色的,边界最亮图像中的值。现在,我正在尝试在提交给 Canny 边缘检测过滤 的图像上计算距离图,我得到与 Canny 过滤器完全相同的结果,除了强度值不同(对于距离图,等高线的值为 1,其他所有值都为 0,我的 Canny 过滤器是在短图像上计算的)。

无法在轮廓图像上计算距离图是否正常?如果没有,我该如何做?

我找到了解决问题的办法。查看 this picture I realized that the issue may come from the fact that my image consists in fine bright contours on a wide dark background. I inverted the brightness intensities of my picture (so the contours became dark on a bright background) and this works well. It seems like it is necessary for distance maps to focus on bright objects instead of dark ones. If anybody could explain this regarding the code of the VTK euclidean distance map 或纠正我,如果我错了,欢迎任何帮助。