Abstract
This paper presents a fast and accurate line extraction algorithm. Conventional line extraction algorithms first extract the edge pixels and then connect these edge pixels into lines. In contrast, the proposed algorithm extracts the lines directly from the input image by tracing the perimeter of an intensity region and then uses simple linear regression to compute the equations of the lines. This proposed method allows the algorithm to use the intensity information in the image to correlate the edge pixels, thus simplifying the computation of the lines and increasing the robustness in the presence of noise. Experiments were performed on a variety of synthetic and natural images and demonstrated that the algorithm can extract lines reliably, while realizing a large improvement in speed over the conventional algorithms.
Introduction
Extracting straight lines from digital images is a cornerstone of computer vision, essential for applications ranging from autonomous navigation to document analysis. Traditionally, this is a two-step serial process: first, edge detection (e.g., Sobel or Canny filters) to create a binary edge map, and second, line fitting (e.g., Hough Transform) to identify lines among those pixels.
However, this traditional approach has significant drawbacks. Binarization discards "intensity correlation"—the inherent grouping of edge pixels that bound specific regions of color or brightness. Furthermore, the Hough Transform is computationally expensive, as every edge pixel must "vote" in a complex parameter space. In noisy environments, these methods often suffer from reduced accuracy or become too slow for real-time use. This paper introduces a novel algorithm that skips the binary edge map step, tracing perimeters directly from intensity regions to achieve massive speedups and improved robustness.
Methodology
The proposed algorithm replaces the standard serial pipeline with a "direct" approach integrated into three primary modes:
- Scanning Mode: The algorithm scans the image until it encounters a significant intensity transition, detected using a standard $3 \times 3$ Sobel operator.
- Perimeter Tracing Mode: Upon finding a transition, a recursive tracing function follows the boundary of the intensity region. It "walks" around the shape counter-clockwise, using original intensity values to maintain the path. To avoid redundant processing, visited pixels are marked with a "ninth bit" in memory.
- Line Feature Extraction Mode: While tracing, the algorithm applies simple linear regression in real-time to calculate line equations. It monitors the Mean Square Error (MSE); if the error exceeds a predefined threshold, the algorithm identifies a corner, terminates the current line, and begins a new one.
The tracing logic relies on evaluating neighboring pixels to determine the next step in the perimeter. This local search ensures that only a tiny fraction of the image's pixels are processed to define the lines, contributing to the algorithm's high efficiency.
Experimental Results
The algorithm was evaluated using $256 \times 256$ grayscale images, including noiseless synthetic polygons, noisy synthetic polygons (Gaussian and 5% salt-and-pepper noise), and a real-world photograph of a Japanese license plate.
The performance gains were substantial:
- Computational Speed: On the license plate image, the proposed algorithm completed in 0.00899 seconds, whereas the Standard Hough Transform (SHT) required 9.55 seconds—a speedup of over 1,000x.
- Accuracy: In noiseless tests, the proposed method achieved 100% accuracy (within a 1-pixel radius), outperforming SHT (97.9%) and the Random Hough Transform (RHT, 98.4%).
- Robustness to Noise: In the noisy synthetic test, the proposed method maintained 98.9% accuracy. In contrast, SHT accuracy dropped significantly to -93.3%, indicating a high rate of false positives.
The algorithm's natural noise filtering—requiring a minimum line length (typically 5 pixels)—allows it to ignore random high-frequency noise that would otherwise clutter a traditional edge detector's output.
Conclusion and Future Work
By leveraging intensity information directly, the proposed algorithm avoids the information loss and computational overhead of traditional edge-map-based methods. While highly efficient, the algorithm's reliance on a fixed Sobel threshold for scanning may miss subtle edges in blurry images. Future work could involve a hierarchical approach with varying thresholds to capture these details. Additionally, extending this direct tracing logic to curves and complex textures remains an open area for research.
Summary updated