Re: surface plot of an image

• To: mathgroup at smc.vnet.net
• Subject: [mg70921] Re: surface plot of an image
• From: bghiggins at ucdavis.edu
• Date: Wed, 1 Nov 2006 03:56:21 -0500 (EST)
• References: <ei4mb2\$e2t\$1@smc.vnet.net>

```Ale,

Suppose you have imported your grayscale image and it is called
myimage. This should be an 2-D array of real numbers between 0 and 1.
The function ListInterpolation takes a matrix of real numbers and then
returns an  InterpolationFunction that allows one to treat the image as
a continuous function.

myinterpolationImage=ListInterpolation[myimage]

The output should look like

InterpolatingFunction[{{1., 336.}, {1., 448.}}, <>]

where  the original image had dimensions (336 , 448)

Now suppose we want to see how the image varies at some x value. Well
we can plot myinterpolationImage for that x-value, say x=150 :

Plot[myinterpolationImage[150, y], {y, 1, 448}, PlotStyle ->
RGBColor[0, 0, 1]];

One can also get a 3D plot of myinterpolationImage over a selected
range:

Plot3D[myinterpolationImage[x, y], {x, 1, 300}, {y, 1, 400}, PlotPoints
-> 50,
Axes -> False, Boxed -> False, ViewPoint -> {0.801, -1.730,
2.796}];

Hope this helps

Cheers

Brian

alemarabi at gmail.com wrote:
> Hi,
>
> I have a microscopy image in gray levels and would like to convert it
> to a surface plot, in order to visualize the differences in grey values
> accros the picture.
> Is there an easy (or already) existing way to do that?