Detects obstruction on the bitmap including blur, glare and reflection.


#include "l_bitmap.h"

L_LTIMGCOR_API L_INT L_BlurDetectionExt(pBitmapOrginal, pOptions, uFlags)


pBITMAPHANDLE pBitmapOrginal

Pointer to the bitmap handle referencing the bitmap to perform the detection on.


Pointer to BLURDETECTIONOPTIONS structure containing the specified options for the detection.

L_UINT uFlags

Reserved for future use. Pass 0.


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


Reports an obstructed regions on the bitmap related to blur, glare and reflection.

This function detects blur as well as any glare or reflection, while L_BlurDetection reports the overall blurriness of the bitmap.

Note that heavily saturated images may return a reflection mask with a high amount of reflection.

When the blur detection options specified by pOptions is no longer needed, free it by calling L_FreeBlurDetectionOptions.

Required DLLs and Libraries


Win32, x64, Linux.

See Also




This example detects obstruction on the provided BITMAPHANDLE including blur, glare, and reflection.

L_INT BlurDetectionExtExample() 
   L_INT nRet; 
   L_INT nGlareZones; 
   BLURDETECTIONOPTIONS blurOptions = { 0 }; 
   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("cannon.jpg")), &LeadBitmap, sizeof(BITMAPHANDLE), 0, ORDER_BGR, NULL, NULL); 
   if (nRet != SUCCESS) 
      return nRet; 
   /* Set the options for blur detection */ 
   blurOptions.rcROI = { 0, 0, LeadBitmap.Width, LeadBitmap.Height }; // This will detect blur on the entire bitmap 
   blurOptions.dBlurThreshold = 0.6; 
   /* Apply detection */ 
   nRet = L_BlurDetectionExt(&LeadBitmap, &blurOptions, 0); 
   if (nRet != SUCCESS) 
      return nRet; 
   nGlareZones = blurOptions.GlareOptions.nZonesCount; 
   /* Save the detected masks */ 
   if (blurOptions.ReflectionOptions.pReflectionMask != NULL) 
      L_SaveBitmap(L_TEXT("./reflection.bmp"), blurOptions.ReflectionOptions.pReflectionMask, FILE_BMP, 24, 0, NULL); 
   if (blurOptions.GlareOptions.pMaskBitmap != NULL) 
      L_SaveBitmap(L_TEXT("./glare.bmp"), blurOptions.GlareOptions.pMaskBitmap, FILE_BMP, 24, 0, NULL); 
   /* Free blur options */ 
   return nRet; 

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.