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

Home » Public Forums » archive » rebin question
Show: Today's Messages :: Show Polls :: Message Navigator
E-mail to friend 
Return to the default flat view Create a new topic Submit Reply
rebin question [message #29823] Fri, 22 March 2002 08:58 Go to previous message
Jonathan Joseph is currently offline  Jonathan Joseph
Messages: 69
Registered: September 1998
Member
I figured I would use rebin to downsample an image by averaging the
pixels in blocks of specified size. What I discovered, was that for
integer type images, rebin averages the pixels, but then instead of
rounding to the nearest integer, simply takes the integer part of
the average. Hence:

print, rebin([5,5,5,5,4], 1)

gives the result of 4, not 5 which is what I would like. I suppose
this is done for speed - to work around the problem, I need to convert
to a floating point type, do the rebin, then round, then convert back
to the proper integer type - a hassle.

But, I would really like a more generic way of doing downsampling
of this sort, without the high overhead of a loop. Apart from
taking the mean of a block of pixels, I would also like the option
of downsampling using the median of a block of pixels, or using the
mean of a block of pixels disregarding the farthest outlier (or
n outliers).

Has anyone written IDL code to do downsampling in a more generalized
way than rebin, or have any clever ideas about how to do it quickly?

Thanks
[Message index]
 
Read Message
Read Message
Previous Topic: Re: Examine "Saved" IDL procedures now too!
Next Topic: NaN's in TOTAL, etc.

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

Current Time: Wed Oct 08 11:00:38 PDT 2025

Total time taken to generate the page: 0.00234 seconds