! ! UNSHARP - Contrast Enhance an image using an Unsharp-Mask ! ! Usage: unsharp imno wbuf fwidth iwt ! ! where: ! imno = buffer with the source image (replaced with the enhanced image) ! wbuf = working buffer for temporary creation of the mask ! fwidth = width of the blurring kernel, should be odd (e.g., 3 or 5) ! [default: 3] ! contrast = contrast factor [default: 3] ! ! Uses a square boxcar filter to create the unsharp mask, then subtracts ! the mask from the image according to: ! final = (contrast*image) - (contrast-1)*mask ! ! Puts a comment in the FITS header with the W and C parameters. ! ! 1994 July 22 ! R. Pogge, OSU Astronomy ! Modified: 1998 Nov 8 ! PARAMETER IMNO WORK FWID CONTRAST IF CONTRAST==0 THEN CONTRAST=3 END_IF IF FWID==0 THEN FWID=3 END_IF COPY $WORK $IMNO SMOOTH $WORK FW=FWID BOXCAR MULTIPLY $IMNO CONST=CONTRAST MULTIPLY $WORK CONST=(CONTRAST-1) SUB $IMNO $WORK STRING USMPAR '(W=%i2 C=%i2)' FWID CONTRAST STRING NEWOBJ '%A - USM Enhanced %A' '{?IMNO:OBJECT}' '{USMPAR}' CH $IMNO '{NEWOBJ}' FITS $IMNO CHAR=COMMENT 'Unsharp-Mask Enhanced {USMPAR}' DISPOSE $WORK CONTRAST=0 FWID=0 END