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

COLOR_QUAN question



My question concerns the R, G, and B arrays returned by the COLOR_QUAN
function.  I've noticed that I don't receive the same RGB values if I call the function
multiple times with the same input arguments.  This isn't very noticeable upon visual
inspection of the resulting images, unless the differences are exaggerated by color map
operations such as histogram equalization.

Here is a test program that illustrates what I'm seeing:


device,true_color=24, decomposed=0

; Create 3 square arrays with values in range [0,255]
bw1 = bytscl(indgen(100,100))
bw2 = rotate(bw1,1)
bw3 = rotate(bw1,2)

; STEP 1:  Quantize an image where the R, G, and B image components are the same
image = color_quan(bw1, bw1, bw1, r1, g1, b1, colors=256)
tvlct,r1,g1,b1
window, 1, xsize=100, ysize=100
tv,image

; STEP 2:  Quantize an image with different RGB components
image = color_quan(bw1, bw2, bw3, r2, g2, b2, colors=256)
tvlct,r2,g2,b2
window, 2, xsize=100, ysize=100
tv, image

;STEP 3:  Repeat STEP 1
image = color_quan(bw1, bw1, bw1, r3, g3, b3, colors=256)
tvlct,r3,g3,b3
window, 3, xsize=100, ysize=100
tv,image

; Print out any indices with differences in the palettes of STEP 1 and 3.
print,'Red   differences:', where(r1 ne r3)
print,'Green differences:', where(g1 ne g3)
print,'Blue  differences:', where(b1 ne b3)

end


When I run this on a UNIX Sun Workstation, I get a list of several differences with
each PRINT statement.

If I include the /MAP_ALL keyword with each call to COLOR_QUAN, the discrepancies
disappear.  However, the documentation indicates that /MAP_ALL should be used
only if /GET_TRANSLATION is also present (which I don't think I need.)

Should I expect to see the differences above, and is it safe to use the /MAP_ALL
keyword to eliminate those differences?


Dan Peduzzi
peduzzi@mediaone.net