flood-fill

How can I find hole in a 2D matrix?

生来就可爱ヽ(ⅴ<●) 提交于 2019-11-30 03:29:10
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 the white region I mean it'll have to be fully enclosed by cell's with value '1' (e.g. here we can see three holes marked as 1, 2 and 3). I've come up with a pretty naive solution: 1. Search the whole matrix for cells with value '0' 2. Run a DFS(Flood-Fill) when such a cell (black one) is encountered and check whether we can touch the boundary of the

Floodfill in objective c

喜你入骨 提交于 2019-11-29 22:35:28
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 containing black dot also.but I am really confuse how to identify the pixels in a particular white area.Any help is appreciated.. Theres lots of source code available for flood fill algos. You can probably find a good one and throw it in a method http://www.google.co.uk/search?q=c+flood+fill+algorithm If its been written in C/C++ you can use it in

android using flood fill algorithm getting out of memory exception

倾然丶 夕夏残阳落幕 提交于 2019-11-29 08:57:36
after your suggestions i got working code: public class FingerPaint extends Activity { private RelativeLayout drawingLayout; private MyView myView; @Override protected void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); myView = new MyView(this); setContentView(myView); drawingLayout.addView(myView); } public class MyView extends View { private Paint paint; private Path path; Bitmap mBitmap; ProgressDialog pd; final Point p1 = new Point(); Canvas canvas; //Bitmap mutableBitmap ; public MyView(Context context) { super(context); this.paint = new Paint(); this.paint

How can I find hole in a 2D matrix?

徘徊边缘 提交于 2019-11-29 01:03:24
问题 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 the white region I mean it'll have to be fully enclosed by cell's with value '1' (e.g. here we can see three holes marked as 1, 2 and 3). I've come up with a pretty naive solution: 1. Search the whole matrix for cells with value '0' 2. Run a DFS

Floodfill in objective c

亡梦爱人 提交于 2019-11-28 19:17:38
问题 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 containing black dot also.but I am really confuse how to identify the pixels in a particular white area.Any help is appreciated.. 回答1: Theres lots of source code available for flood fill algos. You can probably find a good one and throw it in a

How to optimally solve the flood fill puzzle?

大城市里の小女人 提交于 2019-11-28 16:06:26
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 flood-fills. I'm trying to write a program which can solve this puzzle optimally. What's the best way to approach this problem? Ideally I want to use the A* algorithm, but I have no idea what should be the function estimating the number of steps left. I did write a program which conducted a depth-4 brute force search to maximize the filled area. It worked

Fill color on bitmap in android

你。 提交于 2019-11-28 13:05:03
问题 How i can fill color on image(i.e fuel image) in specific area as per Seek bar progress. i have tried following solution but it is not helpful much as per my requirement. please find below image for more reference. 回答1: You could also draw a bitmap on top of the layer you have. Simply add a bitmap with the same dimensions as the bar (or whatever you have) you want to have coloured in. Then add the colours and say how far it should colour in the bar. Example: // making our bitmap and canvas

Non-recursive implementation of Flood Fill algorithm?

强颜欢笑 提交于 2019-11-28 11:17:57
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 that for this purpose, a non-recursive implementation of this algorithm is recommended. So I ask you: Could you describe a non-recursive implementation of the Flood Fill algorithm ? An actual code example, some pseudo-code, or even a general explanation will all be welcome. I'm looking for simplest, or the most efficient implementation you can think

OpenCV floodfill with mask

不问归期 提交于 2019-11-27 19:06:52
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 detector output can be used as a mask to stop filling at edges. It is possible to use the same mask in multiple calls to the function to make sure the filled area does not overlap. How does the function update the mask? Does it set all the pixels within the floodfill to some non-zero value? All zero-valued pixels in the same connected component as the seed

Android: How to do this framing paint?

百般思念 提交于 2019-11-27 12:31:36
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 Should be also there. I have try with the FloodFill color but doing that i can only able to do color in to the perticular portion. as FloodFill only fill the color till the same pixwl color comes. If the touch place pixel color get change the it will not fill color on it. So Usinf FloodFill i got the result like below image, If i press on the hand, then