Tuesday, August 3, 2010

Creating Object boundaries in IDL

pro OBJECTBOUNDARY_SMOOTHING

;Initializing the display
DEVICE, DECOMPOSED = 0, RETAIN = 2
LOADCT, 0

;Reading a jpeg file
file = FILEPATH('meteor_crater.jpg', SUBDIRECTORY = ['examples','data'])
READ_JPEG,file, f,/GRAYSCALE
sz = SIZE(f, /DIMENSIONS)
print, sz

;creating a window
WINDOW, 0, XSIZE = (2*SZ[0]),YSIZE=(SZ[1])

TV,f,0

;writing a text object on image
XYOUTS, 50, 220, 'Original Image', ALIGNMENT = 0.5, /DEVICE, COLOR = 255

;Image smoothing
f1 = smooth(f,7,/edge_truncate)
tvscl, f1,1
XYOUTS, (50+SZ[0]), 220, 'SMOOTH IMAGE', ALIGNMENT = 0.5, /DEVICE, COLOR = 255

end

No comments: