pro Mopening
; Handle TrueColor displays:
DEVICE, DECOMPOSED=0
;Read the image
path=FILEPATH('pollens.jpg',SUBDIR=['examples','demo','demodata'])
READ_JPEG, path, img
; Create window:
WINDOW, 0, XSIZE=700, YSIZE=540
;Show original image
XYOUTS, 180, 525, 'Original Image', ALIGNMENT=.5, /DEVICE
TV, img, 20, 280
;Apply the threshold
thresh = img GE 140B
;Load a simple color table
TEK_COLOR
;Display edges
XYOUTS, 520, 525, 'Edges', ALIGNMENT=.5, /DEVICE
TV, thresh, 360, 280
;Apply opening operator
open = MORPH_OPEN(thresh, REPLICATE(1,3,3))
;Show the result
XYOUTS, 180, 265, 'Opening Operator', ALIGNMENT=.5, /DEVICE
TV, open, 20, 20
;Show pixels that have been removed in white
XYOUTS, 520, 265, 'Removed Pixels in White', ALIGNMENT=.5, /DEVICE
TV, open + thresh, 360, 20
end
No comments:
Post a Comment