L_BlurDetectionExt (original) (raw)
Summary
Detects obstruction on the bitmap including blur, glare and reflection.
Syntax
#include "l_bitmap.h"
L_LTIMGCOR_API L_INT L_BlurDetectionExt(pBitmapOrginal, pOptions, uFlags)
Parameters
pBITMAPHANDLE pBitmapOrginal
Pointer to the bitmap handle referencing the bitmap to perform the detection on.
BLURDETECTIONOPTIONS *pOptions
Pointer to BLURDETECTIONOPTIONS structure containing the specified options for the detection.
L_UINT uFlags
Reserved for future use. Pass 0.
Returns
Value | Meaning |
---|---|
SUCCESS | The function was successful. |
< 1 | An error occurred. Refer to Return Codes. |
Comments
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
- 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, Linux.
See Also
Functions
Topics
Example
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;
}