Unsharp Mask
Apply unsharp mask to image
1. imgUnsharpmask a:=40; 2. imgUnsharpmask a:=20 r:=3 t:=3 option:=yuv img:=mat(1) oimg:=mat(2);
Please refer to the page for additional option switches when accessing the x-function from script
Display Name |
Variable Name |
I/O and Type |
Default Value |
Description |
---|---|---|---|---|
Adjust | a |
Input int |
|
Specifies the adjustment factor, which is a percentage. The range is from 0 to 500. |
Neighborhood | r |
Input int |
|
Specifies the size of the neighborhood used for detecting edges. The range is from 0 to 1000. |
Threshold | t |
Input int |
|
Specifies the threshold for determining the edges. If the difference between a pixel and its neighborhood is greater than this threshold, this pixel will be considered an edge pixel and will be sharpened. Valid range of this variable is from 0 to 255. |
Color | option |
Input int |
|
Specifies the color space in which to apply the unsharp mask. Option list
|
Input Matrix | img |
Input Image |
|
Specifies the source image to be manipulated. The default input is the active image. |
Output Image | oimg |
Output Image |
|
Specifies the output image. By default, the output image is the same as the input image. See the syntax here. |
This X-Function can be used to remove the blurring from the input image. It identifies pixels that are different from neighboring pixels and increases their contrast. This function can be viewed as a sharpening function. The edges and details in the output image are emphasized and have an enhanced appearance.
//Create a new folder in the Project Explorer pe_mkdir Conversion path:=aa$; pe_cd aa$; //Create a matrix and import a sample image window -t m; path$ = System.path.program$; fname$ = path$ + "samples\Image Processing and Analysis\leaves.jpg"; impimage; window -r %h Original; window -d; //Duplicate the image window -r %h BlueLeave; imgC2gray; //Convert to gray window -d; //Duplicate the image imgUnsharpmask a:=80 r:=30; //Strenghen details window -s T; //Tile the windows horizontally
The computation uses L_UnsharpMaskBitmap() function from LEADTOOLS Main API. Please refer to the LEADTOOLS Main API Help file, Version 14 and read the L_UnsharpMaskBitmap topic.
LEADTOOLS Main API Help file, Version 14