LBitmap::SigmaFilter

#include "ltwrappr.h"

L_INT LBitmap::SigmaFilter(nSize, nSigma, nThreshhold, bOutline, uFlags = 0)

L_UINT nSize;

/* size of neighborhood */

L_UINT nSigma;

/* number of standard deviations */

L_FLOAT nThreshhold;

/* minimum percentage of pixels included to the kernel */

L_BOOL bOutline;

/* boolean flag */

L_UINT32 uFlags;

/* flags */

Performs an edge-preserving average filter on the image.

Parameter

Description

nSize

Size of the averaging neighborhood. It is the length, in pixels, of one side of a square.

nSigma

Number of standard deviations of the kernel calculated pixels must be within. If low values such as 1 or 2 are used, the filter acts more as a noise filtering function that preserves functions.

nThreshhold

Minimum percentage of pixels included to the number of pixels in the kernel. If the percentage is not met, then all the pixels are automatically included. More noise is suppressed with higher threshold values.

The higher the threshold the more noise is suppressed.

bOutline

Boolean flag that indicates whether the central pixel is included in the calculation of the filter. Possible values are:

 

Value

Meaning

 

TRUE

Central pixel is included.

 

FALSE

Central pixel is excluded.

uFlags

Reserved for future use. Must be 0.

Returns

SUCCESS

The function was successful.

< 1

An error occurred. Refer to Return Codes.

Comments

The amount of blur is controlled by specifying the size of the neighborhood.

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 in the Document and Medical Imaging 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

LTIMGCOR

For a listing of the exact DLLs and Libraries needed, based on the toolkit version, refer to Files To Be Included With Your Application.

Platforms

Win32, x64.

See Also

Functions:

LBitmap::TissueEqualize, LBitmap::Sharpen, LBitmap::MedianFilter

Topics:

Raster Image Functions: Filtering Images

 

Removing Noise

Example

#define MAKE_IMAGE_PATH(pFileName) TEXT("C:\\Users\\Public\\Documents\\LEADTOOLS Images\\")pFileName
L_INT LBitmap__SigmaFilterExample()
{
   L_INT nRet;
   LBitmap LeadBitmap;
   nRet = LeadBitmap.Load(MAKE_IMAGE_PATH(TEXT("cannon.jpg")), 0,ORDER_BGR);
   if(nRet !=SUCCESS)
      return nRet;
   nRet = LeadBitmap.SigmaFilter(5, 2, 0.2f, FALSE, 0);;
   if(nRet !=SUCCESS)
      return nRet;
   return SUCCESS;
}