LBitmap::UnsharpMask

#include "ltwrappr.h"

virtual L_INT LBitmap::UnsharpMask (nAmount, nRadius, nThreshold, uFlags)

Sharpens the class object's bitmap by applying the unsharp mask.

Parameters

L_INT nAmount

A percentage value that represents an adjustment factor.

L_INT nRadius

Value that indicates the size of the neighborhood used for blurring each pixel of the class object's bitmap.

L_INT nThreshold

Value that indicates the threshold for modifying the original value of the pixel. If the difference in the original pixel value and the blurred pixel value is greater than the threshold value, the original pixel value will be modified. The valid ranges are:

L_UINT uFlags

Flag that indicates the color space in which to apply the mask. Possible values are:

Value Meaning
RGB_SPACE [0x0001] Apply the mask in the RGB color space.
YUV_SPACE [0x0002] Apply the mask in the YUV color space.

Returns

Value Meaning
SUCCESS The function was successful.
< 1 An error occurred. Refer to Return Codes.

Comments

This function is actually considered a sharpening function. It is used to sharpen the image with a minimum of noise. To reduce the noise, it starts by blurring a copy of the original image. The amount of blur depends on nRadius. The function then determines the difference between each pixel's value of the original image and the corresponding pixel's value in the blurred image. If the difference is greater than the nThreshold value, then the difference between the pixel values is multiplied by the value in the nAmount parameter and added to the original pixel value.

To increase the thickness of the sharpened edges, increase the value of nRadius.

To increase the amount of sharpness, increase the value of nAmount.

To reduce the noise and eliminate the small edges or individual pixels that will produce noise in image, increase the value of nThreshold.

Using the YUV color space decreases the processing time but some color shift may happen.

To update a status bar or detect a user interrupt during the execution of this function, refer to LBase::EnableStatusCallback.

This function supports 12 and 16-bit grayscale and 48 and 64-bit color images. Support for 12 and 16-bit grayscale and 48 and 64-bit color images is available only in the Document/Medical toolkits.

This function does not support 32-bit grayscale images. It returns the error code ERROR_GRAY32_UNSUPPORTED if a 32-bit grayscale image is passed to this function.

Required DLLs and Libraries

Platforms

Win32, x64.

See Also

Functions

Topics

Example

L_INT LBitmap__UnsharpMaskExample(LBitmap & Bitmap, L_TCHAR * szFileName) 
{ 
   L_INT nRet; 
 
   nRet =Bitmap.Load(szFileName); 
   if(nRet !=SUCCESS) 
      return nRet; 
 
   return Bitmap.UnsharpMask(200, 15, 50, RGB_SPACE); 
} 
Help Version 21.0.2021.7.2
Products | Support | Contact Us | Intellectual Property Notices
© 1991-2021 LEAD Technologies, Inc. All Rights Reserved.

LEADTOOLS Raster Imaging C++ Class Library Help
Products | Support | Contact Us | Intellectual Property Notices
© 1991-2021 LEAD Technologies, Inc. All Rights Reserved.