X
32 Rate this article:
No rating

INTERNAL: Images and lookup tables

Anonym
Topic:
Demonstration of a LUT referencingDiscussion:
Example code that demonstrates a LUT referencing.Solution:
function LutsOFun , imageIn , LUT

; Demonstration of a LUT referencing
; which requires no 'for' loops.
; INPUTS:
; imageInp - array of integer values
; LUT - Look up table
; RETURNS:
; Processed image where array entries
; have been multiplied by LUT entry
; values.
;
; SCK 06 Feb 1997
;
return, LUT(imageIn) * imageIn

END

pro TestLUT

; Tests LutsOFun

im1 = [[8,5,8],[4,4,4],[7,2,0]] ; 3x3 "image"
lut = [0,1,2,3,4,3,2,1,0] ; ramp filter
im2 = LutsOFun(im1,lut)

PRINT, 'INPUT IMAGE:'
PRINT, im1
PRINT

PRINT, 'Look-up table (LUT)'
PRINT, lut
PRINT

PRINT, 'Ramp-filtered image'
PRINT, im2

end