Re: Evaluate ?
- To: mathgroup at smc.vnet.net
- Subject: [mg94551] Re: Evaluate ?
- From: Jens-Peer Kuska <kuska at informatik.uni-leipzig.de>
- Date: Tue, 16 Dec 2008 02:33:45 -0500 (EST)
- Organization: Uni Leipzig
- References: <gi5je7$pi6$1@smc.vnet.net>
- Reply-to: kuska at informatik.uni-leipzig.de
Hi, you explanation hal not much, because one equation for two variables has never a unique solution, it has infinite on and i your case a -> -1 - b + i + j + pixelValuesOfImageA - PixelValuesOfImageB will work for any b and give you an a. Regards Jens rameshbog at gmail.com wrote: > Hi, > Very many thanks for your extremely prompt reply. > Sorry; I was not quite clear about what I wanted - i was trying to be > brief. Actually I was thinking of replacement of a pixel values in an > image. It should replace only when it finds a solution to the equation > [( i - a ) + ( j - b ) + (pixel values of ImageA - pixel values of > ImageB ) <= 1]. > For example: In ImageA, if the position of a pixel is (2,5) and its > intensity value is 100. substiting this information in the above > equation [( 2 - a ) + ( 5 - b ) + (100 - pixel values of ImageB ) <= > 1]. Then solve for ' a ' and ' b '. if there is any solution then the > pixel(2,5) intensity should be changed to ' 0 ' otherwise ' 1'. > > My ultimate goal is 1). to check the each pixel of imageA whether it > satisfies the equation with the imageB. > 2). Count how many pixels (ImageA) satisfied the equation. > > thanks again for your precious time > > Ram > > > On Dec 10, 11:12 am, Jens-Peer Kuska <ku... at informatik.uni-leipzig.de> > wrote: > >> Hi, > > > NSolve[ > ( i - a ) + ( j - b ) + ( ImageA[[i,j]] - ImageFunction[x][y] ) <= > 1, > {a,b} ] > >> is *one* inequality for *two* variables {a,b}. There are either no >> or an infinite number of solutions. x and y are not used in the whole >> loop construction and it is unclear what you mean. > >> It would be better to describe what you wish to do and for what it is >> good for. Because the most of us would give you an solution without >> For[] loops and unsolvable equations. > >> Regards >> Jens > > - Hide quoted text - > - Show quoted text - > ramesh... at gmail.com wrote: >> Hi Mathematica Guru's, > >> I am stuck with a problem in evaluating a continous function. I have >> two images (A and B), out of which ImageB is interpolated with a >> continuous function (ListInterpolation). I want to replace the >> intensity values of ImageA only when it finds a solution to the >> equation. I have NO idea how to get a solution to this equation. So >> please I ask for experts in the field to help me !! > >> Two Images: >> ImageA = Import["image1.tiff]; >> ImageB = Import["image2.tiff]; > >> Interpolation of image B: >> ImageFunction = ListInterpolation[Transpose[ImageB]]; > >> Length of the image: >> Xvalues = Table[a, {a, 1, Length[ImageA]}]; >> Yvalues = Table[b, {b, 1, Length[ImageA[[2]]]}]; > >> (* Here is the confusion should I use Nsolve or Evaluate for an >> equation ?? so that when it is 'true' it should change the intensity >> values of ImageA[[i,j]]=0 otherwise ImageA[[i,j]]=1. > >> Replacement and Evaluation: >> For[i = 1, i = Length[Xvalues], >> For[j = 1, j = Length[Yvalues], > >> (* Please somebody tell me how to Solve an equation in mathematica >> with two different variables(x,y) with a continuous function ) >> Test[i,j] = NSolve[ ( i - a ) + ( j - b ) + ( ImageA[[i,j]] - >> ImageFunction[x][y] ) <= 1, {a,b} ] >> If there is any solution or if it finds any values of 'a' and 'b' for >> the above equation then intenstiy values of ImageA[[i,j]] = 0 >> otherwise ImageA[[i,j]] = 1]; >> j++]; i++]; > >> Finally display the image: >> ListDensityPlot[ImageA[[All, All]], Mesh -> False]; > >> Thanks for your help inadvance !! > >> Ram >