Skip to content

TRUCO: A Scalable Lock-Free Algorithm for Parallel Contour Extraction

Rafael Munoz-Salinas, Francisco J. Romero-Ramirez, Manuel J. Marin-Jimenez

cs.CV

Abstract

Extracting binary contours and their containment hierarchy is a fundamental step in many computer vision pipelines. While the standard Suzuki--Abe algorithm is inherently sequential, existing parallel tracers neither preserve its exact contours nor compute their hierarchy. This paper presents TRUCO (Threaded Raster Unrestricted Contour Ownership), a lock-free parallel algorithm for multi-core CPUs that produces the exact output of Suzuki--Abe. TRUCO relies on two core ideas. First, the image is partitioned into horizontal stripes, and a geometric ownership rule allows each thread to trace complete contours independently across stripe boundaries, avoiding both locks and post-processing merges. Second, contour tracing is decoupled from hierarchy reconstruction, which is performed in a subsequent parallel pass and can be skipped entirely when only the contours are needed. We formally prove that TRUCO is deterministic, data-race-free, and identical in output to Suzuki--Abe regardless of thread count. Across diverse high-resolution datasets-from sparse segmentation masks to dense real-world photographs-TRUCO achieves speedups of 4.7x to 17.4x over the fastest sequential baseline with hierarchy computation, and 2.3x to 17.8x without it.

Create a lesson