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

Home » Public Forums » archive » Sorting and image rescaling
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: Sorting and image rescaling [message #25312 is a reply to message #25176] Mon, 28 May 2001 10:25 Go to previous messageGo to previous message
Craig Markwardt is currently offline  Craig Markwardt
Messages: 1869
Registered: November 1996
Senior Member
Martin Schultz <martin.schultz@dkrz.de> writes:

> Bill <wclodius@lanl.gov> writes:
>
>> I work on some of the software for an imaging sensor. One of the codes I
>> wrote was to generate JPEGS. In order to generate prettier JPEGS I wrote
>> my own bytescaling routine that crudely takes into account the
>> distribution of values within a band image. This routine relies on a
>> single line equivalent to
>>
>> sorted_values = SORT(band_image)
>>
>> where SORT is the IDL intrinsic, and band image is a floating point two
>> dimensional array. I basically use this line to find a set percentage
>> of minum and maximum outliers , and use the maximum and minimum of the
>> remaining inliers to do a linear rescaling to values from 0 to 255.
... Clodius text deleted by CM ...
>
> This sounds like a prime time application for histogram ;-) Just
> don't ask me how to use this magical hat ;-(

I agree with Martin here, but you can probably make it as simple or
complicated as you want.

The simplest way to do it would be to construct a histogram and then
use a FOR loop to nibble x% from the edges, where x is selectable. In
newer versions of IDL you can use the CUMULATIVE option to the TOTAL
function to simplify life a little further, since it avoids the FOR
loop.

I don't think the REVERSE_INDICES keyword of HISTOGRAM helps a whole
lot in this case (whew, some people say). The only benefit is that
the REVERSE_INDICES keyword returns some information on the cumulative
distribution which you might use to your advantage (ie, avoid the FOR
loop again). This appears to be overkill though, and has the
potential to use a lot of memory like the SORT solution does.

Craig

--
------------------------------------------------------------ --------------
Craig B. Markwardt, Ph.D. EMAIL: craigmnet@cow.physics.wisc.edu
Astrophysics, IDL, Finance, Derivatives | Remove "net" for better response
------------------------------------------------------------ --------------
[Message index]
 
Read Message
Read Message
Read Message
Read Message
Read Message
Previous Topic: Re: code snippet
Next Topic: Multiple surface plotting

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

Current Time: Wed Oct 08 13:07:08 PDT 2025

Total time taken to generate the page: 0.00401 seconds