| Author |
Comment/Response |
Ram
|
11/23/08 2:04pm
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 ImageA[[i,j]]=0 otherwise ImageA[[i,j]]=1.
I tried in this way!! and Ofcouse there is something wrong in it*)
Replacement:
For[i = 1, i ≤ Length[Xvalues],
For[j = 1, j ≤ Length[Yvalues],
Test[i,j] = If[Evaluate[(i-ImageFunction[x])^2 +
(j - ImageFunction[y])^2 + (ImageA[[i,j]]-ImageFunction[x][y])^2] <= 1, ImageA[[i,j]]=0,ImageA[[i,j]]=1];j++];i++];
It should evalute (when i = 1 for all continuous x-values of imageB, when j = 1 for all continuous y-values of imageB and differene in pixel value of imageA[1,1] and all continuous pixel values of imageB) <= 1.
Finally display the image:
ListDensityPlot[ImageA[[All, All]], Mesh -> False];
Is it not working because of the continuous function or my approach is wrong or should i use some other function instead of evaluate or the syntax problem??
Thanks for your help inadvance !!
Ram
URL: , |
|