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

Home » Public Forums » archive » Re: 8 to 24 bit conversion
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: 8 to 24 bit conversion [message #41687 is a reply to message #41686] Tue, 09 November 2004 14:40 Go to previous message
Liam Gumley is currently offline  Liam Gumley
Messages: 473
Registered: November 1994
Senior Member
Ken Mankoff wrote:
>
> I am trying to convert an 8 bit image created in the Z buffer to a 24
> bit image. Is this possible? I would think so. But I am having trouble
> getting it to work.
>
> I based my code off of this algorithm:
> http://groups.google.com/groups?hl=en&lr=&selm=c0jq0 j%24i40%241%40nntp6.u.washington.edu
>
> But I don't want to use the COLOR_QUAN bit of code that reduces it back
> to 8 bits.
>
> Can anyone point me to a library that does this, or point out some of
> the errors in the code below? Please don't point out the embarrassing
> optimization errors I know are there...
>
> Thanks
>
> -k.
>
>
> image = TVRD()
> TVLCT, R, G, B, /GET
>
> s = SIZE(image, /DIMENSIONS)
> rImage = BYTARR(s)
> gImage = BYTARR(s)
> bImage = BYTARR(s)
> ; replace this section with a HISTOGRAM statement
> for n=0, 255 do begin
> idx = WHERE(image eq n, count)
> if (count gt 0) then begin
> rImage[idx] = R[n]
> gImage[idx] = G[n]
> bImage[idx] = B[n]
> endif
> endfor
>
> newImage = bytarr( s(0), s(1), 3 )
> newImage[*,*,0] = rImage
> newImage[*,*,1] = gImage
> newImage[*,*,2] = bImage

dims = size(image, /dimensions)
true_image = bytarr(3, dims[0], dims[1])
true_image[0, *, *] = r[image]
true_image[1, *, *] = g[image]
true_image[2, *, *] = b[image]

Cheers,
Liam.
Practical IDL Programming
http://www.gumley.com/
[Message index]
 
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: z-buffer and /noerase ?
Next Topic: Advection routine?

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

Current Time: Tue Dec 02 14:45:12 PST 2025

Total time taken to generate the page: 0.01162 seconds