Detects the potential barcode areas on a bitmap.
#include "l_bitmap.h"
L_LTIMGCOR_API L_INT L_FindBarcodeCandidateAreas(pBitmap, pOptions, pFoundAreas)
Pointer to the bitmap handle referencing the bitmap to detect the barcode areas.
Pointer to a structure that contains the options to be used in detecting the barcode areas.
Pointer to a structure to be updated with the detected barcode candidate areas.
Value | Meaning |
---|---|
SUCCESS | The function was successful. |
< 1 | An error occurred. Refer to Return Codes. |
This function is useful for images that have a barcode but one that is poor quality by returning the barcode bounds and confidence.
This will also provide speedup by using the bounds of the candidates to pass to the L_BarCodeRead on the entire bitmap.
When the detected barcode candidate areas specified by pFoundAreas
is no longer needed, free it by calling L_FreeBarcodeCandidateAreas.
Win32, x64, Linux.
This example processes a bitmap to find potential barcode candidates and gives a confidence value for each area.
L_INT L_FindBarcodeCandidateAreasExample(L_VOID)
{
L_INT nRet;
/* Bitmap handle to hold the loaded image. */
BITMAPHANDLE LeadBitmap;
FIND_BARCODE_CANDIDATE_AREAS_OPTIONS candidateOptions = { 0 };
BARCODE_CANDIDATE_AREAS candidates;
pBARCODEDATA pBarcodeData = NULL;
L_INT nCandidates;
/* Load the bitmap, keeping the bits per pixel of the file the same */
nRet = L_LoadBitmap(MAKE_IMAGE_PATH(L_TEXT("barcode2.tif")), &LeadBitmap, sizeof(BITMAPHANDLE), 24, ORDER_BGR, NULL, NULL);
if (nRet != SUCCESS)
return nRet;
candidateOptions.uStructSize = sizeof(FIND_BARCODE_CANDIDATE_AREAS_OPTIONS);
candidateOptions.uUnits = BARCODE_CANDIDATE_AREAS_USE_PIXELS;
candidateOptions.BackgroundColor = RGB(255, 255, 255);
candidateOptions.BarcodeColor = RGB(0, 0, 0);
candidates.uStructSize = sizeof(BARCODE_CANDIDATE_AREAS);
/* Finds potential barcodes */
nRet = L_FindBarcodeCandidateAreas(&LeadBitmap, &candidateOptions, &candidates);
if (nRet != SUCCESS)
return nRet;
/* Number of barcode candidate areas */
nCandidates = candidates.AreasCount;
L_BarCodeInit(BARCODES_QR_READ);
// Loop through the candidates and read the barcode while storing the data
for (int n = 0; n < nCandidates; n++)
{
L_BarCodeRead(&LeadBitmap, &candidates.Areas[n].Bounds, BARCODE_QR_CODE, BARCODE_SCANLINES_PER_PIXELS, NULL, 0, NULL, NULL, NULL, &pBarcodeData, sizeof(BARCODEDATA));
}
// Free memory
L_FreeBarcodeCandidateAreas(&candidates);
L_BarCodeFree(&pBarcodeData);
L_BarCodeExit();
if (LeadBitmap.Flags.Allocated)
L_FreeBitmap(&LeadBitmap);
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
Your email has been sent to support! Someone should be in touch! If your matter is urgent please come back into chat.
Chat Hours:
Monday - Friday, 8:30am to 6pm ET
Thank you for your feedback!
Please fill out the form again to start a new chat.
All agents are currently offline.
Chat Hours:
Monday - Friday
8:30AM - 6PM EST
To contact us please fill out this form and we will contact you via email.