MathGroup Archive 2008

[Date Index] [Thread Index] [Author Index]

Search the Archive

Continuous function, solve an equation and 2D image

  • To: mathgroup at smc.vnet.net
  • Subject: [mg94287] Continuous function, solve an equation and 2D image
  • From: rameshbog at gmail.com
  • Date: Tue, 9 Dec 2008 23:12:17 -0500 (EST)

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


  • Prev by Date: Small question about Filling between two functions in a determined interval
  • Next by Date: Re: Small question about Filling between two functions in a determined interval
  • Previous by thread: Re: Small question about Filling between two functions in a determined interval
  • Next by thread: Re: Continuous function, solve an equation and 2D image