Hi Puneeth,
The image is black because the TIF image is likely only one band, meaning that the original image is gray-scaled. You either need to supply the RGB values to surface, or create an RGB image. Here is an example of each method.
pro surface_image_texture_example
compile_opt idl2
ireset, /no_prompt
; Read in a 2D array of surface heights
dir = FILEPATH('',SUBDIR=['examples', 'data'])
z = READ_BINARY(dir+'elevbin.dat', DATA_DIMS=[64,64])
; Read in a texture image to overlay
img = Rotate(READ_TIFF( dir+'examples.tif', r, g, b),7)
;create an RGB image
dims = size(img, /dimensions)
img_rgb = make_array(3,dims[0],dims[1], /byte)
img_rgb[0,*,*] = r[img]
img_rgb[1,*,*] = g[img]
img_rgb[2,*,*] = b[img]
;use RGB table
s = SURFACE(z, TEXTURE_IMAGE=img, YSTYLE=1, rgb_table = [[r],[g],[b]],$
window_title = 'Using RGB Table')
;use RGB image
s2 = SURFACE(z, TEXTURE_IMAGE=img_rgb, YSTYLE=1,$
window_title = 'Using RGB Image')
end
|