Jump flooding algorithm

Last updated

The jump flooding algorithm (JFA) is a flooding algorithm used in the construction of Voronoi diagrams and distance transforms. The JFA was introduced by Rong Guodong at an ACM symposium in 2006. [1]

Contents

The JFA has desirable attributes in GPU computation, notably for its efficient performance. However, it is only an approximate algorithm and does not always compute the correct result for every pixel, although in practice errors are few and the magnitude of errors is generally small. [1]

Implementation

The JFA original formulation is simple to implement.

Take an grid of pixels [2] (like an image or texture). All pixels will start with an "undefined" color unless it is a uniquely-colored "seed" pixel. As the JFA progresses, each undefined pixel will be filled with a color corresponding to that of a seed pixel.

For each step size , run one iteration of the JFA:

Iterate over every pixel at .
For each neighbor at where :
if is undefined and is colored, change 's color to 's
if is colored and is colored, if where and are the seed pixels for and , respectively, then change 's color to 's.

Note that pixels may change color more than once in each step, and that the JFA does not specify a method for resolving cases where distances are equal, therefore the last-checked pixel's color is used above.

The JFA finishes after evaluating the last pixel in the last step size. Regardless of the content of the initial data, the innermost loop runs a total of times over each pixel, for an overall computational complexity of .

Variants

Some variants of JFA are:

Uses

The jump flooding algorithm and its variants may be used for calculating Voronoi maps [1] [3] and centroidal Voronoi tessellations (CVT), [4] generating distance fields, [5] point-cloud rendering, [6] feature matching, [7] the computation of power diagrams, [8] and soft shadow rendering. [9] The grand strategy game developer Paradox Interactive uses the JFA to render borders between countries and provinces. [10]

Further developments

The JFA has inspired the development of numerous similar algorithms. Some have well-defined error properties which make them useful for scientific computing. [11]

In the computer vision domain, the JFA has inspired new belief propagation algorithms to accelerate the solution of a variety of problems. [12] [13]

Related Research Articles

<span class="mw-page-title-main">Delaunay triangulation</span> Triangulation method

In computational geometry, a Delaunay triangulation or Delone triangulation of a set of points in the plane subdivides their convex hull into triangles whose circumcircles do not contain any of the points. This maximizes the size of the smallest angle in any of the triangles, and tends to avoid sliver triangles.

<span class="mw-page-title-main">Flood fill</span> Algorithm in computer graphics to add color or texture

Flood fill, also called seed fill, is a flooding algorithm that determines and alters the area connected to a given node in a multi-dimensional array with some matching attribute. It is used in the "bucket" fill tool of paint programs to fill connected, similarly-colored areas with a different color, and in games such as Go and Minesweeper for determining which pieces are cleared. A variant called boundary fill uses the same algorithms but is defined as the area connected to a given node that does not have a particular attribute.

<span class="mw-page-title-main">Ray tracing (graphics)</span> Rendering method

In 3-D computer graphics, ray tracing is a technique for modeling light transport for use in a wide variety of rendering algorithms for generating digital images.

Shor's algorithm is a quantum algorithm for finding the prime factors of an integer. It was developed in 1994 by the American mathematician Peter Shor. It is one of the few known quantum algorithms with compelling potential applications and strong evidence of superpolynomial speedup compared to best known classical algorithms. On the other hand, factoring numbers of practical significance requires far more qubits than available in the near future. Another concern is that noise in quantum circuits may undermine results, requiring additional qubits for quantum error correction.

<span class="mw-page-title-main">Dijkstra's algorithm</span> Graph search algorithm

Dijkstra's algorithm is an algorithm for finding the shortest paths between nodes in a weighted graph, which may represent, for example, road networks. It was conceived by computer scientist Edsger W. Dijkstra in 1956 and published three years later.

<span class="mw-page-title-main">Voronoi diagram</span> Type of plane partition

In mathematics, a Voronoi diagram is a partition of a plane into regions close to each of a given set of objects. It can be classified also as a tessellation. In the simplest case, these objects are just finitely many points in the plane. For each seed there is a corresponding region, called a Voronoi cell, consisting of all points of the plane closer to that seed than to any other. The Voronoi diagram of a set of points is dual to that set's Delaunay triangulation.

<span class="mw-page-title-main">Canny edge detector</span> Image edge detection algorithm

The Canny edge detector is an edge detection operator that uses a multi-stage algorithm to detect a wide range of edges in images. It was developed by John F. Canny in 1986. Canny also produced a computational theory of edge detection explaining why the technique works.

<span class="mw-page-title-main">Quadtree</span> Tree data structure in which each internal node has exactly four children, to partition a 2D area

A quadtree is a tree data structure in which each internal node has exactly four children. Quadtrees are the two-dimensional analog of octrees and are most often used to partition a two-dimensional space by recursively subdividing it into four quadrants or regions. The data associated with a leaf cell varies by application, but the leaf cell represents a "unit of interesting spatial information".

<span class="mw-page-title-main">Deterministic finite automaton</span> Finite-state machine

In the theory of computation, a branch of theoretical computer science, a deterministic finite automaton (DFA)—also known as deterministic finite acceptor (DFA), deterministic finite-state machine (DFSM), or deterministic finite-state automaton (DFSA)—is a finite-state machine that accepts or rejects a given string of symbols, by running through a state sequence uniquely determined by the string. Deterministic refers to the uniqueness of the computation run. In search of the simplest models to capture finite-state machines, Warren McCulloch and Walter Pitts were among the first researchers to introduce a concept similar to finite automata in 1943.

<span class="mw-page-title-main">Volume rendering</span> Representing a 3D-modeled object or dataset as a 2D projection

In scientific visualization and computer graphics, volume rendering is a set of techniques used to display a 2D projection of a 3D discretely sampled data set, typically a 3D scalar field.

<span class="mw-page-title-main">Point-set triangulation</span> Simplicial complex in Euclidean geometry

A triangulation of a set of points in the Euclidean space is a simplicial complex that covers the convex hull of , and whose vertices belong to . In the plane, triangulations are made up of triangles, together with their edges and vertices. Some authors require that all the points of are vertices of its triangulations. In this case, a triangulation of a set of points in the plane can alternatively be defined as a maximal set of non-crossing edges between points of . In the plane, triangulations are special cases of planar straight-line graphs.

k-means clustering is a method of vector quantization, originally from signal processing, that aims to partition n observations into k clusters in which each observation belongs to the cluster with the nearest mean, serving as a prototype of the cluster. This results in a partitioning of the data space into Voronoi cells. k-means clustering minimizes within-cluster variances, but not regular Euclidean distances, which would be the more difficult Weber problem: the mean optimizes squared errors, whereas only the geometric median minimizes Euclidean distances. For instance, better Euclidean solutions can be found using k-medians and k-medoids.

<span class="mw-page-title-main">Lloyd's algorithm</span> Algorithm used for points in euclidean space

In electrical engineering and computer science, Lloyd's algorithm, also known as Voronoi iteration or relaxation, is an algorithm named after Stuart P. Lloyd for finding evenly spaced sets of points in subsets of Euclidean spaces and partitions of these subsets into well-shaped and uniformly sized convex cells. Like the closely related k-means clustering algorithm, it repeatedly finds the centroid of each set in the partition and then re-partitions the input according to which of these centroids is closest. In this setting, the mean operation is an integral over a region of space, and the nearest centroid operation results in Voronoi diagrams.

<span class="mw-page-title-main">Block-matching algorithm</span> System used in computer graphics applications

A Block Matching Algorithm is a way of locating matching macroblocks in a sequence of digital video frames for the purposes of motion estimation. The underlying supposition behind motion estimation is that the patterns corresponding to objects and background in a frame of video sequence move within the frame to form corresponding objects on the subsequent frame. This can be used to discover temporal redundancy in the video sequence, increasing the effectiveness of inter-frame video compression by defining the contents of a macroblock by reference to the contents of a known macroblock which is minimally different.

<span class="mw-page-title-main">Signed distance function</span> Distance from a point to the boundary of a set

In mathematics and its applications, the signed distance function is the orthogonal distance of a given point x to the boundary of a set Ω in a metric space, with the sign determined by whether or not x is in the interior of Ω. The function has positive values at points x inside Ω, it decreases in value as x approaches the boundary of Ω where the signed distance function is zero, and it takes negative values outside of Ω. However, the alternative convention is also sometimes taken instead.

<span class="mw-page-title-main">Fortune's algorithm</span> Voronoi diagram generation algorithm

Fortune's algorithm is a sweep line algorithm for generating a Voronoi diagram from a set of points in a plane using O(n log n) time and O(n) space. It was originally published by Steven Fortune in 1986 in his paper "A sweepline algorithm for Voronoi diagrams."

In computational geometry, the Bowyer–Watson algorithm is a method for computing the Delaunay triangulation of a finite set of points in any number of dimensions. The algorithm can be also used to obtain a Voronoi diagram of the points, which is the dual graph of the Delaunay triangulation.

<span class="mw-page-title-main">David Mount</span> American computer scientist

David Mount is a professor at the University of Maryland, College Park department of computer science whose research is in computational geometry.

<span class="mw-page-title-main">Non-local means</span>

Non-local means is an algorithm in image processing for image denoising. Unlike "local mean" filters, which take the mean value of a group of pixels surrounding a target pixel to smooth the image, non-local means filtering takes a mean of all pixels in the image, weighted by how similar these pixels are to the target pixel. This results in much greater post-filtering clarity, and less loss of detail in the image compared with local mean algorithms.

<span class="mw-page-title-main">Power diagram</span> Partition of the Euclidean plane

In computational geometry, a power diagram, also called a Laguerre–Voronoi diagram, Dirichlet cell complex, radical Voronoi tesselation or a sectional Dirichlet tesselation, is a partition of the Euclidean plane into polygonal cells defined from a set of circles. The cell for a given circle C consists of all the points for which the power distance to C is smaller than the power distance to the other circles. The power diagram is a form of generalized Voronoi diagram, and coincides with the Voronoi diagram of the circle centers in the case that all the circles have equal radii.

References

  1. 1 2 3 4 Rong, Guodong; Tan, Tiow-Seng (2006-03-14). "Jump flooding in GPU with applications to Voronoi diagram and distance transform" (PDF). Proceedings of the 2006 symposium on Interactive 3D graphics and games - SI3D '06. Redwood City, California: Association for Computing Machinery. pp. 109–116. doi:10.1145/1111411.1111431. ISBN   978-1-59593-295-2. S2CID   7282879.
  2. The original paper uses the optimal case, a square grid, as an example, but a grid of any size works. Albeit with reduced efficiency. See this StackOverflow question for more.
  3. 1 2 3 Rong, Guodong; Tan, Tiow-Seng (July 2007). "Variants of Jump Flooding Algorithm for Computing Discrete Voronoi Diagrams". 4th International Symposium on Voronoi Diagrams in Science and Engineering (ISVD 2007). pp. 176–181. doi:10.1109/ISVD.2007.41. ISBN   978-0-7695-2869-4. S2CID   386735.
  4. Guodong Rong; Yang Liu; Wenping Wang; Xiaotian Yin; Gu, X D; Xiaohu Guo (2011-03-25). "GPU-Assisted Computation of Centroidal Voronoi Tessellation". IEEE Transactions on Visualization and Computer Graphics. 17 (3): 345–356. doi:10.1109/TVCG.2010.53. hdl: 10722/132211 . ISSN   1077-2626. PMID   21233516. S2CID   11970070.
  5. Golus, Ben (2021-04-01). "The Quest for Very Wide Outlines". Medium. Retrieved 2021-08-19.
  6. Farias, Renato (2014). "POINT CLOUD RENDERING USING JUMP FLOODING" (PDF).
  7. Yu, Pei; Yang, Xiaokang; Chen, Li (2012). "Parallel-Friendly Patch Match Based on Jump Flooding". In Zhang, Wenjun; Yang, Xiaokang; Xu, Zhixiang; An, Ping; Liu, Qizhen; Lu, Yue (eds.). Advances on Digital Television and Wireless Multimedia Communications. Communications in Computer and Information Science. Vol. 331. Berlin, Heidelberg: Springer. pp. 15–21. doi:10.1007/978-3-642-34595-1_3. ISBN   978-3-642-34595-1.
  8. Zheng, Liping (2019-05-01). "GPU-based efficient computation of power diagram". Computers & Graphics. 80: 29–36. doi:10.1016/j.cag.2019.03.011. ISSN   0097-8493. S2CID   131923624.
  9. Rong, Guodong; Tan, Tiow-Seng (2006-11-01). "Utilizing jump flooding in image-based soft shadows". Proceedings of the ACM symposium on Virtual reality software and technology. VRST '06. Limassol, Cyprus: Association for Computing Machinery. pp. 173–180. doi:10.1145/1180495.1180531. ISBN   978-1-59593-321-8. S2CID   15339123.
  10. Boczula, Bartosz; Eriksson, Daniel (2020). "Optimized Gradient Border Rendering in Imperator: Rome". Intel. Retrieved 2021-03-28.
  11. Schneider, Jens; Kraus, Martin; Westermann, Rüdiger (2010). "GPU-Based Euclidean Distance Transforms and Their Application to Volume Rendering". In Ranchordas, AlpeshKumar; Pereira, João Madeiras; Araújo, Hélder J.; Tavares, João Manuel R. S. (eds.). Computer Vision, Imaging and Computer Graphics. Theory and Applications. Communications in Computer and Information Science. Vol. 68. Berlin, Heidelberg: Springer. pp. 215–228. doi:10.1007/978-3-642-11840-1_16. ISBN   978-3-642-11840-1.
  12. Alchatzidis, Stavros; Sotiras, Aristeidis; Paragios, Nikos (2011-11-06). "Efficient parallel message computation for MAP inference". 2011 International Conference on Computer Vision (PDF). pp. 1379–1386. doi:10.1109/ICCV.2011.6126392. ISBN   978-1-4577-1102-2. S2CID   17554205.
  13. Choi, Jungwook; Rutenbar, Rob A. (2016-08-29). "Configurable and scalable belief propagation accelerator for computer vision". 2016 26th International Conference on Field Programmable Logic and Applications (FPL). pp. 1–4. doi:10.1109/FPL.2016.7577316. ISBN   978-2-8399-1844-2. S2CID   10923625.

As of this edit, this article uses content from "Is Jump Flood Algorithm Separable?" , authored by alan-wolfe, trichoplax at Stack Exchange, which is licensed in a way that permits reuse under the Creative Commons Attribution-ShareAlike 3.0 Unported License, but not under the GFDL. All relevant terms must be followed.