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
1 answer

Flood fill GLUT code not working

I wrote the following piece of code for flood-fill as part of a paint program I'm developing: void setPixel(int x, int y) { glColor4f(red, green, blue, alpha); glBegin(GL_POINTS); glVertex2f(x, y); glEnd(); glFlush(); } void…
Ricky
  • 103
  • 1
  • 2
  • 10
0
votes
1 answer

Flood Fill scan line

I wrote a classic queue floodfill: public static void floodFill(int y, int x, byte originalvalue, byte newvalue, byte[][] arr) { Deque queue = new ArrayDeque(); queue.add(new int[]{y, x}); while (!queue.isEmpty()) { int[] t =…
JohnDow
  • 1,242
  • 4
  • 22
  • 40
0
votes
2 answers

Multidimensional array fill

I'm trying to fill an area in a multidimensional array and not sure on the approach. For example I have the following array: var map = [ [0, 0, 0, 0, 0, 0, 0, 0, 0], [0, 2, 2, 2, 2, 2, 2, 0, 0], [0, 2, 0, 0, 0, 0, 2, 0, 0], [0, 2, 0,…
Joel
  • 385
  • 1
  • 4
  • 13
0
votes
1 answer

Non-recursive Flood-Fill algorithm causes OutOfMemoryError

I'm writing a small drawing application. I'm trying to make a 'bucket fill' tool using a non-recursive implementation of the flood-fill algorithm. However, if the user uses this tool a few times in a row with too short time intervals, it causes an…
Aviv Cohn
  • 15,543
  • 25
  • 68
  • 131
0
votes
1 answer

UVa-784 Wrong Answer

I am going crazy with this problem! My solution is in Java - I have tried different inputs and haven't been able to reproduce the alleged wrong answer. Maybe someone here could possibly point to my solutions bottlenecks? The verdict I am getting…
Reins
  • 1,109
  • 1
  • 17
  • 35
0
votes
1 answer

Canvas to Bitmap

My program is a simple flood-fill game application for android, namely, the user can paint and draw something on the canvas. Now I want to provide a sharing option to the users. I guess that I must begin with copying the canvas to a bitmap object. I…
adba
  • 477
  • 9
  • 25
0
votes
1 answer

How to use extra parameters with image magick on android? (e.g. fuzz in colorFloodFill)

I don't get how to set the fuzz(y) parameter for flood fill: The fuzz member of image defines how much tolerance is acceptable to consider two colors as the same. This code is working, changing all pixels from red to green, but only if it is…
Daniel Brown
  • 1,134
  • 1
  • 13
  • 27
0
votes
1 answer

Coordinate out of bounds! In Java, flood fill

I am trying to find out why I get "Coordinate out of bounds!" when trying to implement the flood fill. It's a black and white image, when there is white nothing should happen when flood filling, and it doesn't so that is good. All black areas is…
user2916202
  • 15
  • 2
  • 5
0
votes
2 answers

Stackoverflow error in flooding

I'm trying to implement flood fill on connected binary image regions, however I get StackOverflow error. Furthermore, how can I color each region with different color. Thanks public void FloodFill(int x, int y) { Bitmap bitmap =…
0
votes
1 answer

Algorithm - how to use 2D Flood Fill with terrain cost?

I have two algorithms for movement in my game - one displays possible moves using Flood Fill, another calculates how to get to any possible location using A*. Right now flood fill returns information in the following format [Origin] [array of…
Alex Stone
  • 46,408
  • 55
  • 231
  • 407
0
votes
0 answers

Floodfill algorithm with seed area (instead of seed point)

in the standard openCV floodfill algorithm you should specify a seed point. Is there an easy way to specify a starting area (so multiple seeding point)? Or do I really have to loop over every point in that area :( Thx!!
user2812874
  • 99
  • 1
  • 2
  • 4
0
votes
1 answer

floodfill android not working when the bitmap is fit to screen with create scaled bitmap

In my app i used flood fill for filling the part of the bitmap with color. Everything worked fine, but I create the bitmap with createscaledbitmap , it does not work. Please suggest me. my code is as follows. I had floodfill run in asynch task. …
Sandeep R
  • 2,284
  • 3
  • 25
  • 51
0
votes
1 answer

flood filling Actionscript3

today's problem involves the flood fill algorythm. What i want to do is make a drawing application in flash that's similar to paint, in the sense that it lets you draw lines with colors you choose from a color picker, it lets you erase parts of what…
0
votes
1 answer

Detecting groups without recursion or stacks/queues

I was trying out this algorithm for detecting groups of like pieces on a grid. It is a simple game demo that drops pieces randomly on a 12x10 grid and after each piece drop checks the grid for any groups that are three or more adjacent pieces. I am…
0
votes
1 answer

Implementing flood fill to check for group - Java

I have been looking over this flood fill implementation for some time now and keep running into the dreaded stack overflow. I am dropping pieces randomly on a 12x10 grid and calling the checkMatches method after each random piece drop to check for…