[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

*Subject*: Re: Sorting and image rescaling*From*: Craig Markwardt <craigmnet(at)cow.physics.wisc.edu>*Date*: 28 May 2001 12:25:16 -0500*Newsgroups*: comp.lang.idl-pvwave*Organization*: U. Wisc. Madison Physics -- Compact Objects*References*: <3B0EDDD2.E285A85@lanl.gov> <ylwg0dp76sx.fsf@faxaelven.dkrz.de>*Reply-To*: craigmnet(at)cow.physics.wisc.edu*Xref*: news.doit.wisc.edu comp.lang.idl-pvwave:25120

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 --------------------------------------------------------------------------

**References**:**Sorting and image rescaling***From:*Bill

**Re: Sorting and image rescaling***From:*Martin Schultz

- Prev by Date:
**Re: xyouts with p.multi** - Next by Date:
**Re: Sorting and image rescaling** - Prev by thread:
**Re: Sorting and image rescaling** - Next by thread:
**Re: Sorting and image rescaling** - Index(es):