2.6.6.8 imgUnsharpmask

Menu Information

Unsharp Mask

Brief Information

Apply unsharp mask to image

Command Line Usage

1. imgUnsharpmask a:=40;
2. imgUnsharpmask a:=20 r:=3 t:=3 option:=yuv img:=mat(1) oimg:=mat(2);

Variables

Display
Name
Variable
Name
I/O
and
Type
Default
Value
Description
Adjust a

Input

int

0

Specifies the adjustment factor, which is a percentage. The range is from 0 to 500.

Neighborhood r

Input

int

1

Specifies the size of the neighborhood used for detecting edges. The range is from 0 to 1000.

Threshold t

Input

int

0

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

rgb

Specifies the color space in which to apply the unsharp mask.

Option list

  • rgb:RGB_Space
Uses the RGB space.
  • yuv:YUV_Space
Uses the YUV space. Generally, computation is faster than using RGB space.
Input Matrix img

Input

Image

<active>

Specifies the source image to be manipulated. The default input is the active image.

Output Image oimg

Output

Image

<input>

Specifies the output image. By default, the output image is the same as the input image.

See the syntax here.

Description

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.

Examples

  • Code Sample
//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

Algorithm

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.

References

LEADTOOLS Main API Help file, Version 14

Related X-Functions

imgSharpen, imgUserfilter