Re: Code is not working...

*To*: mathgroup at smc.vnet.net*Subject*: [mg120467] Re: Code is not working...*From*: Jay Bee <jiri.bocan at gmail.com>*Date*: Sun, 24 Jul 2011 07:38:12 -0400 (EDT)*Delivered-to*: l-mathgroup@mail-archive0.wolfram.com*References*: <201107222347.TAA28685@smc.vnet.net> <j0foq7$8ov$1@smc.vnet.net>

On Jul 24, 1:25 am, Heike Gramberg <heike.gramb... at gmail.com> wrote: > If you want any useful help you'll probably need to give a bit more > information. For example, what are > image, RegionGrowing and imgfilter? And what is the function of > imageFilled (it doesn't seem to do anything > at the moment)? > > Heike. > > On 23 Jul 2011, at 00:47, =?iso-8859-1?Q?S=F6nme... at smc.vnet.net wrot= e: > > > > > > > > > > > Hello, > > > I am in trouble with below codes: > > > I run this code but Program is not finsh evertime It is running and run= ning... > > Could you possible help me. > > > dim = Dimensions[image] > > r = 1; > > k = 1; > > n = 10; > > cost = Function[{positionValues, neighborValues}, > > First[neighborValues] == 1]; > > > (* Image that only contains the value zero *) > > imageNew = Table[0, {i, 1, dim[[1]]}, {j, 1, dim[[2]]}]; > > > (* Walk through the rows of the image *) > > While[r < dim[[1]], > > (* Walk through the columns of the image*) > > k = 1; > > While[k < dim[[2]], > > (* Find a white pixel*) > > If[imgfilter[[r, k]] == 1, > > (* Proceed RegionGrowing and give them a identical value by \ > > multiplying it with n *) > > region = RegionGrowing[{imgfilter}, {{r, k}}, 1, cost]*n; > > (* Add the identical cell to imageNew *) > > imageNew = imageNew + region; > > (* Change n, so each cell has a different value *) > > n = n + 2;As > > (* Take the cell out of the original image, > > so he will stop when there is no white pixel anymore *) > > imageFilled = imgfilter - region; > > ]; > > k++; > > ]; > > r++; > > ]; As Heike asked, what are those functions you use? If the computation lasts forever, there must be some bug... Check all braces - correct number and position, if all the inputs and outputs have an expected format, and so on...

**References**:**Code is not working...***From:*Sönmezer@smc.vnet.net, D. <d.sonmezer@student.tue.nl>