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
0
votes
2 answers

iphone - Filling color in closed image

I'm trying to create an app for children. It will have different images. And those images will have different closed shapes like stars, balls or any other similar images. I am aware of how to draw on iphone. I know how to select a color, how to…
Satyam
  • 15,493
  • 31
  • 131
  • 244
0
votes
0 answers

Flood fill missing a tile or two

edit: It works now, I moved the getting X and Y into a seperate function, and it seemed to have fixed it (I'm not sure exactly what was wrong, sorry) I've been making a Tile Editor using WPF and C#, and I seem to have come across a rather odd…
0
votes
0 answers

FloodFill: Record distance from Origin?

Short question, I implemented the Flood Fill Algorithm (Basically the first pseudo-code) into my C++ code and it works perfectly only I need to record how many tiles it's removed from the origin like this person accomplished. I'm not looking for…
RayShawnOfNapalm
  • 210
  • 6
  • 20
0
votes
3 answers

Find all of adjacent cells/cubes in 3D-space

I am dividing a part of a 3D space into a series of 1x1x1 cubes, and that part may have a volume of 100^3 up to 1000^3, however, the cubes/cells I am really interested in rarely exceed 5000-20000 in their numbers. What I am trying to do is to find…
R. Noe
  • 3
  • 3
0
votes
1 answer

Fill Convex or concave area in c#

I'm programming in c# (windows form) for image processing purpose. I have a Bitmap image. In my image I have closed curve which may be convex or concave. The boundary of curve is illustrated by a special color . I want to fill it by a filling color.…
Babak.Abad
  • 2,839
  • 10
  • 40
  • 74
0
votes
2 answers

python 4 way recursive Flood Fill of a curve

I am trying to use the flood fill algorithm to fill in one of the two colors of this curve, which is defined with red being 1 and blue being zero. However, when I try to run my code, it says that the syntax for the line if m[i][j]=1: is incorrect. …
Bmm
  • 57
  • 1
  • 4
0
votes
1 answer

Finding groups in a single-dimensional grid array

If I have a randomly generated array with 60 items (represented as 6x10) of 6 types (represented as integers 0-5), how can I search for groups of the same type within the array? (Vertically/horizontally connected groups of at least 3.) I'm working…
F8bit
  • 3
  • 2
0
votes
1 answer

Is it possible to optimize this floodfill algorithm any further?

Here's the fiddle for it: https://jsfiddle.net/rujbra6y/3/ I'm already logging the speed so make any changes and just re-run it a couple times to see if the performance increased at all. Been working on it for a couple hours and I can't think of…
Chron Bag
  • 587
  • 4
  • 17
0
votes
1 answer

Flood fill using java Pane - JAVA

Hi I am supposed to create function which would do flood fill on a Pane containing Shapes using Java. It is supposed to behave just like MSPaint, I dont need to later move rectangles Lines or other shapes. I was thinking converting Pane into Image…
Therian
  • 93
  • 1
  • 8
0
votes
2 answers

Recursive Floodfill segmentation fault

I am trying to implement floodfill. This works fine on a 500x500 matrix: int ud[]={1,0,-1,0}; int lr[]={0,1,0,-1}; void fl(int x,int y) { if(x<=0||x>n||y<=0||y>m) return; if(mat[x][y]) // seg fault occurs for this condition return; …
0
votes
1 answer

Flood fill algorithm in JavaScript - too much recursion

So, I'm coding a Bejeweled clone and I have an error in my flood fill function. I have a 15 x 15 matrix of jewels of different color and I try to count the number of tiles with flood-fill. The function is here: function count(x, y, color) { …
mkkekkonen
  • 1,704
  • 2
  • 18
  • 35
0
votes
2 answers

Turning a 2D array of different color into a single color optimally

I am trying to find a solution of the puzzle game 'Flood It'. The main idea is to turn a whole N*M game board of k different colors into a single color. I have to start from the top left corner of the board and turn the same colored block into one…
user4650623
  • 17
  • 2
  • 11
0
votes
1 answer

Partially recursive flood-fill function

This is for an assignment. We were asked to make fully recursive and partially recursive flood-fill functions. I was able to complete the fully recursive function simply enough, but I'm struggling on the partially recursive one. I could use a second…
0
votes
1 answer

Java flood fill algorithm with different neighbourhood inside a grid

First of all, I wanted to say that I'm not very experienced Java programmer but was forced to learn things very quickly by school assignment. The assignment is to create a grid inside which we have a simple image. When a cell inside an image is…
Magda
  • 1
  • 5
0
votes
1 answer

Unsafe C# bitmap floodfill

** How to make 'GetPixel2' work for finding the color at a point ** So I have a bitmap with lots of single colored shapes. I have a list of x,y points for those shapes. Then, a second list with the expected color at those points. Finally have an…
Jordan
  • 19
  • 5