comp.lang.idl-pvwave archive
Messages from Usenet group comp.lang.idl-pvwave, compiled by Paulo Penteado

Home » Public Forums » archive » Re: image data extraction
Show: Today's Messages :: Show Polls :: Message Navigator
E-mail to friend 
Return to the default flat view Create a new topic Submit Reply
Re: image data extraction [message #2181] Fri, 03 June 1994 10:30 Go to previous message
sterner is currently offline  sterner
Messages: 106
Registered: February 1991
Senior Member
landers@tsunami.dseg.ti.com (David Landers) writes:

> Finding image data along a line...

> This just picks points from the image. It doesn't do any image
> interpolation or anything like that. Just finds the closest x,y to the
> line.
... Text dropped ...

There is now an easy way to do this. Recent versions of IDL include
a function called INTERPOLATE which does linear, bilinear, or
trilinear interpolation depending on the dimension of the input array.

Let z be an array to extract a line from.
Let (ix1,iy1) and (ix2,iy2) be endpoints of the desired line.
Let n be the number of points desired along the line.

The 2-d indices into array z along the line are:

x = ix1 + (ix2-ix1)*findgen(n)/(n-1)
y = iy1 + (iy2-iy1)*findgen(n)/(n-1)

The desired values (bilinearly interpolated) along the line are now simply:

c = interpolate(z,x,y)

If you would like nearest neighbor interpolation do:

c2 = interpolate(z,round(x),round(y))

where ROUND is another fairly recent addition to IDL.


This also works if x and y trace a curve instead of a straight line.
You could use the mouse to draw a curve on an image and extract the
values along that curve.


Warning: INTERPOLATE has a keyword to do cubic interpolation.
It's easy to use, just add /cubic to the call.
However, don't assume this is better. Check it very carefully before
you rely on it. A number of people have reported problems with /cubic
in other routines (CONGRID, ROT). If the result of the cubic interp.
is carefully examined it will be found to have high frequency wiggles
in the values (with a period of roughly 20 some pixels for the case
I just checked). As of V3.6 beta this problem still exists (for
INTERPOLATE anyway). The default, bilinear, works very well.

Ray Sterner sterner@tesla.jhuapl.edu
Johns Hopkins University North latitude 39.16 degrees.
Applied Physics Laboratory West longitude 76.90 degrees.
Laurel, MD 20723-6099
[Message index]
 
Read Message
Read Message
Read Message
Previous Topic: Garbage collection and Memory
Next Topic: write_gif problems???

-=] Back to Top [=-
[ Syndicate this forum (XML) ] [ RSS ] [ PDF ]

Current Time: Fri Oct 10 16:57:43 PDT 2025

Total time taken to generate the page: 0.64109 seconds