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

Home » Public Forums » archive » Re: gamma correction
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: gamma correction [message #31237 is a reply to message #31236] Thu, 27 June 2002 11:06 Go to previous messageGo to previous message
Rick Towler is currently offline  Rick Towler
Messages: 821
Registered: August 1998
Senior Member
"David Fanning" <david@dfanning.com> wrote in message
> Dick Jackson (dick@d-jackson.com) writes:
>
>> Usually, colortables are used with 2D (nx, ny) images where the byte
values are
>> looked up in the RGB colortables, while 3D images (3, nx, ny) have their
byte
>> values used exactly as given.
>>
>> Less common, but equally valid, is to display a 3D image where each
plane's byte
>> values are looked up in the colortables. Gamma_CT changes the
colortables so
>> that an image that uses them appears to have had its 'gamma' changed.
>>
>
> Well, it does on PCs and Macs. I'm not sure it
> does on UNIX machines, at least not in all versions
> of IDL. :-)
>
> But here is an alternative point of view. Normally, we
> think of gamma as affecting the "brightness" of an
> image. Dick's example has the effect of actually
> changing the colors in the image, which may lead
> us away from the gamma idea.
>

Gamma is not really brightness but color intensity. Gamma correction
adjusts your image data to compensate for the nonlinear relationship between
the image's RGB values and the displayed intensity of the pixel on the
screen. On 8 bit systems gamma correction is usually applied to the LUT but
on 24 bit systems it is applied to the image data at some point between the
frame buffer and the phosphor on your screen. Many newer computers ship
with some type of gamma correction in place. As far as I understand, *and I
don't*, the basic idea is:


;typical gamma for a typical monitor
gamma=2.5

;read an image
image_file = filepath('elev_t.jpg', $
subdirectory=['examples', 'data'])
read_jpeg, image_file, image_data

;display original image
window, 0
tvimage, image_data

;display "gamma corrected" image
gc_image = byte(0 > image + image^(1/gamma) < 255)
window, 1
tvimage, gc_image


Now I can't stress more that there are all sorts of details I am ignorant of
and thus are omitted from the example above.


So to answer the original posters question:

As David and Dick pointed out the built in gamma correct functions act on
the LUT which is meaningless for your average 24 bit image. There isn't a
function in IDL to gamma correct a 24bit image but it should be fairly easy
to implement. Search the web and newsgroups for info and example code.


-Rick
[Message index]
 
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Previous Topic: Re: Delvar?
Next Topic: Delvar?

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

Current Time: Sun Oct 12 02:14:46 PDT 2025

Total time taken to generate the page: 1.03775 seconds