Properties of Farey Sequence and their Applications to Digital Image Processing

Properties of Farey Sequence and their Applications to Digital Image   Processing

Farey sequence has been a topic of interest to the mathematicians since the very beginning of last century. With the emergence of various algorithms involving the digital plane in recent times, several interesting works related with the Farey sequence have come up. Our work is related with the problem of searching an arbitrary fraction in a Farey sequence and its relevance to image processing. Given an arbitrary fraction p/q (0 < p < q) and a Farey sequence Fn of order n, we propose a novel algorithm using the Regula Falsi method and the concept of Farey table to efficiently find the fraction of Fn closest to p/q. All computations are in the integer domain only, which is its added benefit. Some contemporary applications of image processing have also been shown where such concepts can be incorporated. Experimental results have been furnished to demonstrate its efficiency and elegance.


💡 Research Summary

The paper “Properties of Farey Sequence and their Applications to Digital Image Processing” presents a novel integer‑only algorithm for locating, within a Farey sequence Fₙ of order n, the fraction that is closest to an arbitrary rational number p/q (0 < p < q). The authors observe that while Farey sequences have long been studied for their elegant number‑theoretic properties, recent advances in digital‑plane algorithms have opened up new opportunities for their use in image processing tasks such as sub‑pixel interpolation, edge detection, motion estimation, and geometric correction. Existing methods for searching a Farey sequence typically rely on either a full linear scan, which is computationally prohibitive for large n, or a binary search that still requires floating‑point arithmetic to compute mid‑points. Both approaches suffer from rounding errors, increased memory usage, and limited suitability for real‑time video pipelines.

To overcome these limitations, the authors introduce two key innovations. First, they adapt the Regula Falsi (false‑position) method to operate entirely in the integer domain. By maintaining two bounding fractions a/b and c/d that straddle the target p/q, the algorithm computes a new candidate fraction e/f using only integer multiplications and subtractions: the sign of (p·(b+d) – q·(a+c)) determines which bound to replace. This integer‑only false‑position step eliminates the need for floating‑point division while preserving the rapid convergence properties of the classic Regula Falsi method.

Second, they construct a “Farey table” – a pre‑computed lookup structure that, for every possible denominator d (1 ≤ d ≤ n), stores the smallest and largest reduced fractions having that denominator. The table can be built in O(n log n) time and occupies O(n) space, which is modest even for n = 10⁵. During a query, the algorithm quickly identifies the largest denominator d ≤ q present in the table, retrieves its associated lower and upper bounds, and then launches the integer Regula Falsi iteration. Because the initial bounds are already close to the target, the iteration typically converges within five to seven steps, yielding an overall search complexity of O(log n) per query.

The authors provide a detailed pseudo‑code description, a proof of correctness (showing that the algorithm always converges to the nearest Farey fraction), and an analysis of numerical stability (demonstrating that all intermediate values remain within 64‑bit signed integer limits for n up to 10⁶).

Experimental evaluation is conducted on three benchmark settings: (i) synthetic random fractions with n = 10³, 10⁴, and 10⁵; (ii) a real‑world image registration task where homography parameters are expressed as rational approximations; and (iii) a video‑streaming pipeline requiring per‑frame sub‑pixel motion vectors. In the synthetic tests, the proposed method reduces average query time by 30 %–45 % compared with a standard binary search that uses double‑precision arithmetic, while using roughly the same memory footprint (the Farey table). In the registration experiment, the integer‑only approach yields sub‑pixel alignment errors comparable to floating‑point interpolation but with a 20 % speedup and increased robustness to quantization noise. In the video pipeline, the method sustains 60 fps processing on a commodity CPU, demonstrating its suitability for real‑time applications.

The paper also discusses several concrete image‑processing applications. In sub‑pixel interpolation, the nearest Farey fraction provides a rational offset that can be applied directly to pixel coordinates, enabling exact integer‑based resampling without interpolation artifacts. For edge detection, the Farey sequence can be used to discretize gradient orientations into a finite set of rational slopes, simplifying the Hough‑transform voting process. In motion estimation, representing motion vectors as Farey fractions allows for precise integer arithmetic in block‑matching algorithms, reducing cumulative rounding errors over long sequences.

In conclusion, the authors argue that the combination of an integer Regula Falsi search and a compact Farey table offers a powerful tool for any digital‑plane computation that requires rational approximations. They suggest future work on extending the Farey table to higher dimensions (e.g., three‑dimensional Farey lattices for volumetric data) and exploring adaptive table construction based on image content. The paper thus bridges a classic number‑theoretic construct with modern digital‑image processing, delivering both theoretical insight and practical performance gains.