Questions tagged [flood-fill]

Flood fill is an algorithm to determine node adjacency in graphics or multidimensional data sets.

Flood Fill (sometimes known as Seed Fill) is an algorithm to determine node adjacency in graphics or multidimensional data sets, commonly used for "paint bucket"-style operations.

See also

475 questions
10
votes
3 answers

which flood-fill algorithm is better for performance?

i'm trying to implement an algorithm which is flood-fill alike. the problem is that i'm not sure in what way i should implement it e.g recursive - non-recursive. i know that each has its defects but one of them must be faster than the other one. the…
igal k
  • 1,883
  • 2
  • 28
  • 57
10
votes
4 answers

Region Growing Algorithm

Hey everyone. I'm really struggling to figure out the logic with this one and was hoping you could help me out. Before I continue I just want to let you know that I am amateur programmer and a beginner at that, with no formal Computer Science…
danem
  • 1,495
  • 5
  • 19
  • 35
9
votes
4 answers

How can we find the largest contiguous region of a graph with two different "ID"s?

I've recently learned about the Flood-Fill Algorithm, an algorithm that can take a graph and assign each node a component number in O(N) time. For example, a common problem that can be solved efficiently with the Flood-Fill Algorithm would be to…
9
votes
1 answer

Getting touch coordinates not accurate in ImageView FloodFill Algorithm

I'm trying to use a Fill Flood algorithm for make a Cube Painting tool for an app. This is the code of the algorithm: public class QueueLinearFloodFiller { protected Bitmap image = null; protected int[] tolerance = new int[] { 0, 0, 0 }; protected…
9
votes
2 answers

Running the Optimal Flood Fill on a Grid While Limited to just Non-Intersecting Squares

I need to optimize a grid by taking the number of "elements" in it and minimizing it as much as possible. When I say element, I'm referring to a section within that grid. Here's essentially what "input" could look like in a visual sense: The…
Freesnöw
  • 30,619
  • 30
  • 89
  • 138
7
votes
3 answers

Android: How to do this framing paint?

I Have Some static images like below: Now, I want is, when i touch on the face or hand, then the selected color should be fill on that skin portion. See below image of result: So how to get the result like above ?? Redo and Undo Functionality…
Shreyash Mahajan
  • 23,386
  • 35
  • 116
  • 188
7
votes
1 answer

Matlab function equivalent for Python (Flood Fill)

Quick question, I'm looking for a python function that performs the equivalent job that matlab's imfill.m does. I realize that python has openCV but I have been unable to get that to work properly and am trying to find a substitute for it. The part…
Doomchinchilla
  • 465
  • 5
  • 14
7
votes
2 answers

OpenCV - How to use floodFill with RGB image?

I am trying to use floodFill on an image like below to extract the sky: But even when I set the loDiff=Scalar(0,0,0) and upDiff=Scalar(255,255,255) the result is just showing the seed point and does not grow larger (the green dot): code: Mat…
Hadi GhahremanNezhad
  • 2,377
  • 5
  • 29
  • 58
7
votes
7 answers

Flood Fill Algorithms

Its the weekend again, and that means I get to play with my hobby project. I've gotten tired of creating test levels by hand, so I thought I'd take a break from engine development and work on a level editor: Level Editor…
FlySwat
  • 172,459
  • 74
  • 246
  • 311
7
votes
0 answers

iOS Swift Flood fill algorithm

I created this extension for "bucket fill" (flood fill) of touch point: extension UIImageView { func bucketFill(startPoint: CGPoint, newColor: UIColor) { var newRed, newGreen, newBlue, newAlpha: CUnsignedChar let pixelsWide =…
Libor Zapletal
  • 13,752
  • 20
  • 95
  • 182
6
votes
1 answer

How to flood fill with Color of pattern image in swift?

I have achieved to flood fill on the close boundary with solid color. Now I am trying to fill close boundary with UIColor but it is pattern image color (Pattern color). I also try to get points of close area where i tap and fill that area with use…
6
votes
1 answer

Total water capacity in a 2D array, which represents a topographical map

I was recently asked this question in an interview and I couldn't figure out how to implement it. I am hoping someone can point me in the right direction on how to approach this problem. Problem Statement: Given a 2D array of integers find the total…
yesh
  • 2,052
  • 4
  • 28
  • 51
6
votes
1 answer

Java Flood Fill issue

I need to write a flood fill algorithm to color pixels of an image which are inside black borders. I've wrote the following based on some posts here on SO: private Queue queue = new LinkedList(); private int pickedColorInt =…
Tomislav Turcic
  • 879
  • 1
  • 11
  • 24
6
votes
2 answers

Flood Fill implementation

This is my C# implementation of a stack-based flood fill algorithm (which I based on wikipedia's definition). Earlier while coding, I only wanted to see it work. And it did. Then, I wanted to know the number of pixels that was actually filled. So in…
libzz
  • 589
  • 2
  • 10
  • 29
6
votes
1 answer

Is there a parallel flood fill implementation?

I've got openMP and MPI at my disposal, and was wondering if anyone has come across a parallel version of any flood fill algorithm (preferably in c). If not, I'd be interested in sketches of how to do parallelise it - is it even possible given its…
mchen
  • 9,808
  • 17
  • 72
  • 125
1
2
3
31 32