L_SigmaFilterBitmap

Summary

Performs an edge-preserving average filter on the image.

Syntax

#include "l_bitmap.h"

L_LTIMGCOR_API L_INT EXT_FUNCTION L_SigmaFilterBitmap(pBitmap, nSize, nSigma, fThreshhold, bOutline, uFlags)

Parameters

pBITMAPHANDLE pBitmap

Pointer to the bitmap handle that references the bitmap to be affected.

L_UINT nSize

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

L_UINT 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.

L_FLOAT fThreshhold

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.

L_BOOL 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.

L_UINT32 uFlags

Reserved for future use. Must be 0.

Returns

Value Meaning
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.

Sigma Function - Before

Sigma Function - Before

Sigma Function - After

Sigma Function - After

View additional platform support for this Sigma function.

Required DLLs and Libraries

Platforms

Win32, x64, Linux.

See Also

Functions

Topics

Example

This example loads a bitmap and applies the Sigma Filter on it

L_INT SigmaFilterExample(L_VOID) 
{ 
   L_INT nRet; 
   BITMAPHANDLE LeadBitmap; /*Bitmap handle to hold the loaded image*/ 
 
   /* Load the bitmap, keeping the bits per pixel of the file */ 
   nRet = L_LoadBitmap(MAKE_IMAGE_PATH(TEXT("sample5.cmp")), 
      &LeadBitmap, sizeof(BITMAPHANDLE), 0, 
      ORDER_BGR, NULL, NULL); 
   if (nRet != SUCCESS) 
      return nRet; 
 
   //Apply Sigma filter 
   nRet = L_SigmaFilterBitmap(&LeadBitmap, 10, 2, 0.2f, FALSE, 0); 
   if (nRet != SUCCESS) 
      return nRet; 
 
   //free bitmap 
   if (LeadBitmap.Flags.Allocated) 
      L_FreeBitmap(&LeadBitmap); 
 
   return SUCCESS; 
} 

Help Version 22.0.2023.7.11
Products | Support | Contact Us | Intellectual Property Notices
© 1991-2023 LEAD Technologies, Inc. All Rights Reserved.

LEADTOOLS Raster Imaging C API Help

Products | Support | Contact Us | Intellectual Property Notices
© 1991-2023 LEAD Technologies, Inc. All Rights Reserved.