flood-fill

Finding a cost for a maze path

£可爱£侵袭症+ 提交于 2019-12-13 09:33:38
问题 I have this maze: ##++############## ##++++++++++++++## ########++######## ##++++++++##----## ##++########--#### The "#" symbols are walls in the maze. The "+" regions of the maze are reachable regions of the maze from the entry point, and the "-" region of the maze are unreachable from the entry point. The entry point is located at the top of the maze. What I would like to do now is plot a cost of the reachable regions in the maze, which will look like this: ##00############## ##++02++04++06

Cannot Generate Texture From Bitmap

佐手、 提交于 2019-12-13 08:23:06
问题 I am using floodfill algorithm to fill a black white picture with specific color with user touches. I used this Question to use floodfill algorithm : How to use flood fill algorithm in Android? the problem is sometime(whey i want to fill fast) I get Cannot Generate Texture From Bitmap error and mBitmap.getPixel(x, y) returns 0 and filling will be stop! I can use copyPixelsToBuffer ( pictureBuffer ) instead of getPixel() method According to last post of this link : http://www.developpez.net

Filling edges using flood fill not working properly

戏子无情 提交于 2019-12-13 07:56:52
问题 I am using openCV in python to detect cracks in concrete. I am able to use canny edge detection to detect cracks. Next, I need to fill the edges. I used floodfill operation of openCV but some of the gaps are filled whereas some are not filled. The image on the left is the input image whereas that on the right is the floodfilled image. I am guessing this is because my edges have breaks at points. How do i solve this ? My code for floodfilling: im_th1 = imginput im_floodfill = im_th1.copy() #

Flood fill algorithm in JavaScript - too much recursion

China☆狼群 提交于 2019-12-13 06:47:52
问题 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) { if(matrix[x] && matrix[x][y]) { if(matrix[x][y].color != color) return; cnt++; count(x, y+1, color); count(x, y-1, color); count(x-1, y, color); count(x+1, y, color); console.log(cnt); } } What's wrong? 回答1: It looks like your problem is that your function

C++ - Eclipse behavior is different while debugging and running

。_饼干妹妹 提交于 2019-12-13 04:22:54
问题 I am creating a flood fill algorithm in C++ using Eclipse IDE . The algorithm contains a vector of vectors called image . A square is drawn in this image based on user input, segmenting the image to two regions (inside and outside the square). A clicked point is taken in as input. If this point is inside the square, all points inside the square will be changed to a fill_value (in this case, 25). If it is outside the square, all pixels outside the square changes to fill_value . Here is the

FloodFill in iPhone

≡放荡痞女 提交于 2019-12-13 04:10:04
问题 I'm very new to iPhone development. I want to create a application using FloodFill algorithm in iPhone. I'm have no idea about FloodFill. Please Explain me the purpose of FloodFill algorithm.If you give a sample application for FloodFill(iPhone)means I'm really, really happy..Because I'm exploring about FloodFill since morning but, nothing I'm found. My task is, I want to fill the image with color as part by part. Which means, if I'm choosing one color and click on the particular area of the

Number of Groups/Islands of 1's in a Matrix: Definition clarification

核能气质少年 提交于 2019-12-12 04:39:05
问题 I am studying various solutions for Number of Groups (or "islands") of 1's in a Matrix, and while the following clear & concise Java solution looks in the right direction, it also looks incomplete to me: /* * Given a matrix of 0's and 1's, * find the number of groups of 1's in the matrix. * * A group of 1's is defined as all ADJACENT 1's * vertically or horizontally but not diagonally. */ public class Islands { /** * main entry point */ public static void main(String[] args) { int[][] A = new

Floodfill implementetion

假如想象 提交于 2019-12-12 02:52:02
问题 I have a problem with my flood fill function: void floodfill(int x, int y,Pixel old, Pixel new){ Pixel current = getPixel(x,y); if(current.r == old.r && current.g == old.g && current.b == old.b){ setPixel(x,y,new); floodfill(x+1,y,old,new); floodfill(x-1,y,old,new); floodfill(x,y+1,old,new); floodfill(x,y-1,old,new); floodfill(x+1,y+1,old,new); floodfill(x-1,y-1,old,new); floodfill(x+1,y+1,old,new); floodfill(x-1,y+1,old,new); } } In struct 'Pixel' I have rgb values of the pixel. I am trying

Flood Fill Algorithm Resulting in Black Image

不问归期 提交于 2019-12-12 01:10:07
问题 I'm constructing a flood fill algorithm that will hopefully, eventually, find a face in the center of a photograph based on the color at the exact center, and similar colors surrounding that. At the moment, however, my algorithm should take in any color within the bounds of the int array and transfer it over to a holder array, essentially making a copy of the original image. But this isn't working, and is resulting in a black image when I run it. Can anyone see the problem I'm missing? public

Detecting groups without recursion or stacks/queues

我与影子孤独终老i 提交于 2019-12-11 23:24:37
问题 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 using the following code in an attempt to do this without flood fill, recursion, or stacks/queues. It seems to almost work, but will destroy squares that are not of the same type sometimes, or leave squares that should be destroyed. So, is the