L_BitmapWienerFilter

#include "l_ltimgcor.h"

L_LTIMGCOR_API L_INT L_BitmapWienerFilter(pBitmap, pPSF, dNoiseToSignalRatio, uFlags)

Applies a Wiener filter to an image to de-blur it.

Parameters

pBITMAPHANDLE pBitmap

Pointer to the bitmap handle referencing the bitmap to which the Wiener filter will be applied.

POINTSPREADFUNCTION pPSF

Pointer to a POINTSPREADFUNCTION structure.

L_DOUBLE dNoiseToSignalRatio

The noise-to-signal power ratio of the additive noise in the original image.

L_UINT uFlags

Reserved for future use.

Returns

Value Meaning
SUCCESS
< 1 An error occurred. Refer to Return Codes.

Comments

The Wiener filter can be useful when the point spread function and added noise are either known or can be estimated.

Use the Run method to apply the Wiener filter on the distorted image.

Use the L_BitmapAdaptiveWienerFilter to remove noise from images. Use the L_BitmapWienerFilter to de-blur an image.

This function supports 24-bit color images and 8-bit grayscale images.

This function does not support signed data images. It returns the error code ERROR_SIGNED_DATA_NOT_SUPPORTED if a signed data image is passed to this function.

Required DLLs and Libraries

Platforms

Win32, x64, Linux.

See Also

Functions

Topics

Example

L_INT BitmapWienerFilterExample(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("IMAGE1.CMP")), &LeadBitmap, sizeof(BITMAPHANDLE), 0, ORDER_BGR, NULL, NULL);  
   if(nRet !=SUCCESS) 
      return nRet; 
 
   pPOINTSPREADFUNCTION pPointSpreadFunction = { 0 }; 
 
   nRet = L_CreatePreDefinedFilter(&pPointSpreadFunction, 5, 0.8, CREATE_MOTION_FILTER); 
   if (nRet != SUCCESS) 
   { 
      L_FreeBitmap(&LeadBitmap); 
      return nRet; 
   } 
 
   nRet = L_BitmapWienerFilter(&LeadBitmap, *pPointSpreadFunction, 0.001, 0); 
 
   if (nRet == SUCCESS) 
      L_SaveBitmap(MAKE_IMAGE_PATH(TEXT("test.cmp")), &LeadBitmap, FILE_CMP, 24, 2, NULL); 
 
   L_FreePredefinedFilter(pPointSpreadFunction); 
   L_FreeBitmap(&LeadBitmap); 
 
   return nRet; 
} 
Help Version 20.0.2020.4.3
Products | Support | Contact Us | Intellectual Property Notices
© 1991-2020 LEAD Technologies, Inc. All Rights Reserved.

LEADTOOLS Raster Imaging C API Help