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

Home » Public Forums » archive » changing contrast and brightness on the fly
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: changing contrast and brightness on the fly [message #25502 is a reply to message #25432] Wed, 20 June 2001 07:11 Go to previous messageGo to previous message
Liam E. Gumley is currently offline  Liam E. Gumley
Messages: 378
Registered: January 2000
Senior Member
JD Smith wrote:
> A standard feature of astronomical viewers. For a solution which uses
> only colormap fiddling (vs. full image rescaling), see atv:
>
> http://cfa-www.harvard.edu/~abarth/atv/atv.html
>
> This brings up the age old question of how best to dynamically redisplay
> images (brightnest/contrast/etc.). With only 255 colors, making the top
> 100 white to increase brightness is pretty wasteful, and cuts down on
> the dynamic visual range... much better (and slower) is to rescale the
> image range of interest into the full colormap.
>
> Here's how Andrew (and cohorts) did it:
>
> +++++++++++++++++++++++++++++++++++++++++++
> pro atv_stretchct, brightness, contrast, getmouse = getmouse
>
> ; routine to change color stretch for given values of
> ; brightness and contrast.
> ; Complete rewrite 2000-Sep-21 - Doug Finkbeiner
> ; This routine is now shorter and easier to understand.
>
> common atv_state
> common atv_color
>
> ; if GETMOUSE then assume mouse positoin passed; otherwise ignore
> ; inputs
>
> if (keyword_set(getmouse)) then begin
> state.brightness = brightness/float(state.draw_window_size[0])
> state.contrast = contrast/float(state.draw_window_size[1])
> endif
>
> x = state.brightness*(state.ncolors-1)
> y = state.contrast*(state.ncolors-1) > 2 ; Minor change by AJB
> high = x+y & low = x-y
> diff = (high-low) > 1
>
> slope = float(state.ncolors-1)/diff ;Scale to range of 0 : nc-1
> intercept = -slope*low
> p = long(findgen(state.ncolors)*slope+intercept) ;subscripts to select
> tvlct, r_vector[p], g_vector[p], b_vector[p], 8
>
> end
> +++++++++++++++++++++++++++++++++++++++++++


Is it fair to say that this method will only give satisfactory results
when IDL is running in 8-bit display mode?

Cheers,
Liam.
[Message index]
 
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Previous Topic: Re: New book: "Practical IDL Programming"
Next Topic: Re: contour boundaries

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

Current Time: Wed Oct 08 16:51:56 PDT 2025

Total time taken to generate the page: 0.00355 seconds