Tuesday, October 6, 2009

Image Cropping in IDL

;################################################

;              Image Cropping Example

;              Author : S.Ganesh Babu

;###############################################

PRO EX34

world = READ_PNG(FILEPATH('avhrr.png',SUBDIRECTORY=['examples','data']),R,G,B)

DEVICE, RETAIN = 2, DECOMPOSED = 0

TVLCT, R, G,B

worldSize = SIZE(world,/DIMENSIONS)

WINDOW, 0, XSIZE = worldSize[0], YSIZE= worldSize[1]

TV, world

;CURSOR, LeftLowX, LeftLowY, /DEVICE

;CURSOR, RightTopX, RightTopY, /DEVICE

af = world[312:475, 103:264]

;af = world[LeftLowX:RightTopX, LeftLowY:RightTopY]

WINDOW, 2, XSIZE=(475 - 312+1),YSIZE=(264 - 103 +1)

TV, af

END

;################################################

;              Image Cropping Example

;              Author : S.Ganesh Babu

;###############################################

PRO EX34

world = READ_PNG(FILEPATH('avhrr.png',SUBDIRECTORY=['examples','data']),R,G,B)

DEVICE, RETAIN = 2, DECOMPOSED = 0

TVLCT, R, G,B

worldSize = SIZE(world,/DIMENSIONS)

WINDOW, 0, XSIZE = worldSize[0], YSIZE= worldSize[1]

TV, world

;CURSOR, LeftLowX, LeftLowY, /DEVICE

;CURSOR, RightTopX, RightTopY, /DEVICE

af = world[312:475, 103:264]

;af = world[LeftLowX:RightTopX, LeftLowY:RightTopY]

WINDOW, 2, XSIZE=(475 - 312+1),YSIZE=(264 - 103 +1)

TV, af

END

No comments: