Copyright © Fred Weinhaus My scripts are available free of charge for non-commercial (non-profit) use, ONLY. For use of my scripts in commercial (for-profit) environments or non-free applications, please contact me (Fred Weinhaus) for licensing arrangements. My email address is fmw at alink dot net. If you: 1) redistribute, 2) incorporate any of these scripts into other free applications or 3) reprogram them in another scripting language, then you must contact me for permission, especially if the result might be used in a commercial or for-profit environment. Usage, whether stated or not in the script, is restricted to the above licensing arrangements. It is also subject, in a subordinate manner, to the ImageMagick license, which can be found at: http://www.imagemagick.org/script/license.php Please read the Pointers For Use on my home page to properly install and customize my scripts. |
Adaptively sharpens an image or extract edges. |
last modified: December 15, 2018
USAGE: sharp [-m method] [-s sharpen] infile outfile
-m ............ method ....... method=0 is edge extract; method=1 is sharpen PURPOSE: To sharpen an image or extract edges adaptively. DESCRIPTION: SHARP is an adaptive technique to either sharpen an image or extract edges. It applies an adaptive gain factor based upon the image's local standard deviation to a high pass filtered version of the image and adds that to a low pass filtered version of the image. The adaptive formula R = method*M + G*H. Here R is the resulting image. M is the low pass filtered image which is the local mean image generated by applying a 3x3 average convolution to the input image, I. H = (I - M) is the high pass filtered image. G is the gain image, which is computed as G = (factor*std)/(S + (factor*std/mg)). Here std is the image's global standard deviation, mg is a maximum gain constant and S is the image's local standard deviation in the 3x3 neighborhood. ARGUMENTS: -m method - method is either 0 or 1. A value of 0 for method indicates edge extraction and value of 1 for method indicates sharpening. The default=1. -f factor factor is the sharpening/edge extraction gain factor. It is a multiplier to the image's actual standard deviation. The value for factor must be greater than or equal to 0. A value of about 0.5 leaves the image nearly unchanged. A smaller value blurs the image or extract more edges. A larger value sharpens the image or extracts fewer edges. This transition value is not exact and is likely image statistics dependent as the result is a mix of the low pass filtered image (not the original image) and the adaptive high pass filtered image. Factor is floating point number. The default=2. CAVEAT: No guarantee that this script will work on all platforms, nor that trapping of inconsistent parameters is complete and foolproof. Use At Your Own Risk. |
Adaptive Sharpening/Blurring Of A True Color Image |
||||
Original Image |
Arguments: |
Arguments: |
Arguments: |
Arguments: |
Adaptive Edge Extraction From A Grayscale Image |
||||
Original Image |
Arguments: |
Arguments: |
Arguments: |
Arguments: |
What the script does is as follows:
This is equivalent to the following IM commands for
|