Detects obstruction on the bitmap including blur, glare and reflection.
#include "l_bitmap.h"
L_LTIMGCOR_API L_INT L_BlurDetectionExt(pBitmapOrginal, pOptions, uFlags)
Pointer to the bitmap handle referencing the bitmap to perform the detection on.
Pointer to BLURDETECTIONOPTIONS structure containing the specified options for the detection.
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.
Win32, x64, Linux.
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 */
L_FreeBlurDetectionOptions(&blurOptions);
return nRet;
}
Help Collections
Raster .NET | C API | C++ Class Library | HTML5 JavaScript
Document .NET | C API | C++ Class Library | HTML5 JavaScript
Medical .NET | C API | C++ Class Library | HTML5 JavaScript
Medical Web Viewer .NET
Multimedia
Direct Show .NET | C API | Filters
Media Foundation .NET | C API | Transforms
Supported Platforms
.NET, Java, Android, and iOS/macOS Assemblies
Imaging, Medical, and Document
C API/C++ Class Libraries
Imaging, Medical, and Document
HTML5 JavaScript Libraries
Imaging, Medical, and Document