NeurIPS 2026Coming to NeurIPS?Explore papers, orals & directions

Efficient Euclidean distance transform using perpendicular bisector segmentation

Jun Wang, Ying TanCVPR 2011

Introduction

The Distance Transform (DT) is a cornerstone operation in computer vision, image processing, and robotics. It maps every background pixel in a binary image to the distance to its nearest feature (foreground) pixel. Among various metrics, the Euclidean Distance Transform (EDT) is highly valued for its rotational invariance and physical accuracy. However, achieving exact EDT in linear time $O(N)$ with high practical efficiency has remained a challenge. This paper introduces PBEDT (Perpendicular Bisector Euclidean Distance Transform), a novel algorithm that leverages the geometric properties of perpendicular bisectors and optimized integer arithmetic to provide a fast, stable, and exact 2D EDT.

The Challenge of Exact EDT

Calculating the exact EDT is computationally demanding. A naive brute-force approach scales quadratically with the number of pixels ($O(N^2)$). While several $O(N)$ algorithms exist, they often suffer from high constant factors or performance degradation when faced with complex image geometries or noise. Some "propagation-based" methods are sensitive to image content, leading to unpredictable execution times. The goal of PBEDT is to provide a mathematically exact solution that maintains consistent high performance regardless of the input image's complexity.

The PBEDT Methodology

PBEDT is structured as a two-stage independent scan algorithm, decomposing the 2D problem into manageable 1D sub-problems.

Stage One: Column-wise Scan

In the first stage, the algorithm performs a single pass over each column. For every pixel, it identifies the closest feature point within that same column. This step effectively reduces the search space for the subsequent stage.

Stage Two: Row-wise Segmentation

The core innovation of PBEDT lies in its second stage, where it determines the "influence" of feature points across each row. Instead of treating the problem as finding the lower envelope of parabolas—a common but computationally intensive approach—PBEDT treats it as a segmentation problem.

Geometric construction of the perpendicular bisector $B_{uv}$ between two feature points $u$ and $v$, intersecting a scanline at $p(c^r_{uv}, r)$.

As shown in Figure 1, the boundary between the regions of influence for two feature points $u$ and $v$ is their perpendicular bisector $B_{uv}$. For any given row $r$, the intersection of this bisector with the row defines the point $p(c^r_{uv}, r)$ where the nearest feature point changes from $u$ to $v$.

Four scenarios (a-d) illustrating how the influence of feature points $u, v, w$ is partitioned along a row using perpendicular bisectors.

Figure 2 illustrates how this logic scales to multiple points. By maintaining a stack of active feature points and calculating their bisector intersections, the algorithm partitions each row into segments. If a feature point's region of influence is found to be empty for a specific row (e.g., it is "hidden" by other points), it is discarded.

Optimization through Integer Arithmetic

A significant bottleneck in many EDT implementations is the use of floating-point math to find intersection points. The authors demonstrate that because pixel coordinates are integers, the intersection points can be calculated using exact integer division. This not only ensures mathematical exactness but also significantly boosts speed on hardware with limited floating-point performance. The final squared distance for each pixel is then computed using a simplified formula requiring minimal arithmetic operations.

Experimental Evaluation

The authors benchmarked PBEDT against several state-of-the-art algorithms, including those by Maurer, Saito, and Meijster, using both synthetic and standard datasets.

  • Speed: PBEDT consistently outperformed competitors. In tests with randomly generated squares, PBEDT completed the transform in 0.279 seconds, while the next fastest algorithm (Meijster) took 0.391 seconds—a 40% increase in time.
  • Stability: Many existing algorithms exhibit "spikes" in execution time when images are rotated (e.g., at 45°). PBEDT demonstrated remarkable rotational stability, with execution times remaining nearly constant regardless of the orientation of objects within the image.
  • Complexity: Empirical results confirmed the theoretical $O(N)$ linear time complexity, with performance scaling predictably with image size rather than content density.

Conclusion

PBEDT represents a significant advancement in the computation of the Euclidean Distance Transform. By reframing the problem through the lens of perpendicular bisector segmentation and optimizing for integer-based computation, the authors have created an algorithm that is both theoretically sound and practically superior. Its independence from image content and rotational stability makes it an ideal candidate for real-time applications in computer vision and medical imaging. Future work aims to extend this efficient segmentation approach to 3D and higher-dimensional spaces.

Summary updated

BibTeX
@inproceedings{wang2011efficient,
  author = {Jun Wang and Ying Tan},
  title = {{Efficient Euclidean distance transform using perpendicular bisector segmentation}},
  booktitle = {IEEE/CVF Conference on Computer Vision and Pattern Recognition},
  year = {2011},
  doi = {10.1109/cvpr.2011.5995644},
}
Figure