8 to 24 bit conversion [message #41688] |
Tue, 09 November 2004 14:31 |
KM
Messages: 29 Registered: October 2004
|
Junior Member |
|
|
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
|
|
|