Scales and converts anarray to byte data type.
Min The minimum value of array elements to be considered. If Min is not specified, array is searched for its smallest value.
Top The maximum value of the scaled result. (Default: 255)
BYTSCL linearly scales all values of array that lie in the range (Min x Max) into the range (0 x Top). The result has the same number of dimensions as the original array.
If the values of array are outside this range (Min x Max), BYTSCL maps all values of array Min to zero, and maps all values of array Max to Top (255 by default).
arr = FINDGEN(100) byt = BYTSCL(arr, Max=50.0) PRINT, SIZE(byt)
1 100 1 100
PRINT, byt
0 5 10 15 20 25 30 35 40 45 50 56 61 66 71 76 81 86 91
96 101 107 112 117 122 127 132 137 142 147 152 158 163 168 173 178 183 188
193 198 203 209 214 219 224 229 234 239 244 249 255 255 255 255 255 255 255
255 255 255 255 255 255 255 255 255 255 255 255 255 255 255 255 255 255 255
255 255 255 255 255 255 255 255 255 255 255 255 255 255 255 255 255 255 255
255 255 255 255 255
b
. The argument
BYTSCL(b, Min = 50, Max = 70)
b
so all bytes with a value less than or equal to 50 are set to 0, and all bytes with a value greater than or equal to 70 are set to 255. All bytes with a value between 50 and 70 are scaled to lie in the range {0...255}.
OPENR, unit, FILEPATH('whirlpool.img', Subdir = 'data'), /Get_Lun
b = BYTARR(512,512)
READU, unit, b FREE_LUN, unit !Order = 1 LOADCT, 3 WINDOW, 0, Xsize = 1024, Ysize = 512
TV, b, 0
TV, BYTSCL(b, Min = 50, Max = 70), 1
Figure 2-5 Galaxy image before (left) and after (right) contrast enhancement.
Figure 2-6 Galaxy image before (left) and after (right) contrast enhancement.