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
34
votes
9 answers

Fill the holes in OpenCV

I have an edge map extracted from edge detection module in OpenCV (canny edge detection). What I want to do is to fill the holes in the edge map. I am using C++, and OpenCV libraries. In OpenCV there is a cvFloodFill() function, and it will fill…
Lily
  • 5,872
  • 19
  • 56
  • 75
34
votes
10 answers

How to optimally solve the flood fill puzzle?

I like playing the puzzle game Flood-It, which can be played online at: https://www.lemoda.net/javascript/flood-it/game.html It's also available as an iGoogle gadget. The aim is to fill the whole board with the least number of successive…
felix
  • 647
  • 1
  • 6
  • 10
31
votes
3 answers

OpenCV floodfill with mask

The documentation for OpenCV's floodfill function states: The function uses and updates the mask, so you take responsibility of initializing the mask content. Flood-filling cannot go across non-zero pixels in the mask. For example, an edge…
1''
  • 26,823
  • 32
  • 143
  • 200
24
votes
2 answers

Android - Canvas Black when using Flood-Fill

When I implement my flood-fill class it turns my entire Bitmap black. Obviously this is not the desired effect. I've looked at the following threads: https://stackoverflow.com/questions/24030858/flood-fill-is-coloring-my-entire-screen Flood Fill…
Jawascript
  • 683
  • 1
  • 7
  • 23
21
votes
5 answers

How can I find hole in a 2D matrix?

I know the title seems kind of ambiguous and for this reason I've attached an image which will be helpful to understand the problem clearly. I need to find holes inside the white region. A hole is defined as one or many cells with value '0' inside…
mushfek0001
  • 3,845
  • 1
  • 21
  • 20
19
votes
12 answers

a working non-recursive floodfill algorithm written in C?

I've been trying to find a working floodfill algorithm. Of the many algorithms I've tried only the 'recursive line fill' one behaves exactly as it should with the major caveat that it occasionally blows the stack. :( I have tried many non-recursive…
horseyguy
  • 29,455
  • 20
  • 103
  • 145
15
votes
3 answers

Vector graphics flood fill algorithms?

I am working on a simple drawing application, and i need an algorithm to make flood fills. The user workflow will look like this (similar to Flash CS, just more simpler): the user draws straight lines on the workspace. These are treated as vectors,…
sydd
  • 1,824
  • 2
  • 30
  • 54
14
votes
2 answers

Floodfill in objective c

I am trying for a coloring app and to figure out floodfill in objective c anybody did this before..???I am reading all pixel data in a picture and i can change it also..but floodfill can only do what i want exactly.. ..Here I Can identify the pixels…
Sat
  • 1,616
  • 3
  • 22
  • 40
14
votes
1 answer

OpenCV - Floodfill onto new Mat

Given a point on an image, I'd like to floodfill all points connected to that point - but onto a new image. A naive way to do this would be to floodfill the original image to a special magic colour value. Then, visit each pixel, and copy all…
1''
  • 26,823
  • 32
  • 143
  • 200
13
votes
4 answers

Flood fill using a stack

I am using the recursive Flood fill algorithm in Java to fill some areas of a image. With very small images it works fine, but when de image becomes larger the JVM gives me a Stack Over Flow Error. That's the reason why I have to reimplement the…
dafero
  • 1,017
  • 4
  • 13
  • 27
12
votes
5 answers

Android flood-fill algorithm

Does anyone know a iterative and efficient algorithm for flood-fill? Or is there any way to implement recursive floodfill algorithm without stack overflow error? Tried the one @ Flood fill using a stack but i cant find a way to work on white and…
Pillz
  • 301
  • 1
  • 2
  • 13
12
votes
1 answer

Why is my A* implementation slower than floodfill?

I have a blank grid of 100, 100 tiles. Start point is (0,0), goal is (99,99). Tiles are 4-way connections. My floodfill algorithm finds the shortest path in 30ms, but my A* implementation is around 10x slower. Note: A* is consistently slower (3 -…
cyrus
  • 1,338
  • 3
  • 17
  • 26
12
votes
3 answers

How can I perform flood fill with HTML Canvas?

Has anyone implemented a flood fill algorithm in javascript for use with HTML Canvas? My requirements are simple: flood with a single color starting from a single point, where the boundary color is any color greater than a certain delta of the color…
Paul Chernoch
  • 5,275
  • 3
  • 52
  • 73
11
votes
2 answers

Non-recursive implementation of Flood Fill algorithm?

I'm working on a small drawing application in Java. I'm trying to create a 'bucket-fill' tool by implementing the Flood Fill algorithm. I tried using a recursion implementation, but it was problematic. Anyway, I searched around the web and it seems…
Aviv Cohn
  • 15,543
  • 25
  • 68
  • 131
11
votes
2 answers

OpenCV Skin Detection

I've been doing some skin detection but can't get a smooth one. The image below contains the input (left) and output (right) using the code also attached below. Now, the desired output should have been the bottom most image (the one that is smooth…
Og Namdik
  • 823
  • 4
  • 14
  • 22
1
2 3
31 32