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

Home » Public Forums » archive » Re: Average over odd/even lines
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: Average over odd/even lines [message #51817 is a reply to message #51792] Thu, 07 December 2006 10:58 Go to previous messageGo to previous message
JD Smith is currently offline  JD Smith
Messages: 850
Registered: December 1999
Senior Member
On Wed, 06 Dec 2006 19:46:16 -0800, Pete wrote:

> Hi All,
>
> I am trying to write an IDL program for "smoothing" over lines of image
> data acquired with an aerial CCD system. This requires reading the odd
> lines, calculating the mean and placing it in the even. The images are
> a constant 640x480 pixels.
>
> i.e.)
> line 1 : 2 2 2 2...
> line 2 : x x x x...
> line 3 : 4 4 4 4...
>
> After processing,
>
> line 1 : 2 2 2 2...
> line 2 : 3 3 3 3...
> line 3 : 4 4 4 4...
>
> I can think of several ways to implement this but I thought the group
> may point me to the most efficient.

This is a good chance to use the mostly neglected stride operator for
IDL's range subscripts, which has the syntax [low:high:stride].

d=size(a,/DIMENSIONS)
x=indgen(d[0]) & y=findgen((d[1]-1)/2)+.5
a[*,1:d[1]-2:2]=interpolate(a[*,0:*:2],x,y,/GRID)

Note that the last line is unchanged for images with an even number of
lines (that comes from (d[1]-1)/2).

Since your dimensions never change, you can cache x & y and use them
over and over. For this reason as well, it might also be faster to
expand out [*,1:d[1]-2:2] etc. into index arrays and cache them,
rather than have IDL recompute them for each image. It would be
lovely if IDL provided a function to convert a given subscript syntax
into an array of indices, but I don't believe it has one.

JD
[Message index]
 
Read Message
Read Message
Read Message
Read Message
Previous Topic: Re: Returning Land Type
Next Topic: Re: Data elimination from array

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

Current Time: Sun Oct 12 07:19:56 PDT 2025

Total time taken to generate the page: 1.52155 seconds