Contains functions for detecting tables in an image.
#include "l_bitmap.h"
L_LTIMGCOR_API L_INT L_DetectTablesBitmap(pBitmap, pOptions, pOutputs)
Pointer to the bitmap.
Pointer to the specified options for the table detection.
Pointer to the table results obtained after calling this function.
Value | Meaning |
---|---|
SUCCESS | The function was successful. |
< 1 | An error occurred. Refer to Return Codes. |
If L_DetectLinesBitmap has been called prior to this function, then manually pass in the DETECT_LINES_RESULT to the DETECT_TABLES_OPTIONS to speed up processing.
Win32, x64, Linux.
This example detects horizontal and vertical lines in an image.
L_INT L_DetectTablesBitmapExample()
{
DETECT_TABLES_OPTIONS TablesDetectOptions = { 0 };
DETECT_TABLES_RESULT TablesDetectResult;
DETECT_LINES_OPTIONS LinesDetectOptions = { 0 };
DETECT_LINES_RESULT LinesDetectResult;
BITMAPHANDLE LeadBitmap = { 0 };
CORELINE FirstVerticalLine;
L_INT nVerticalLineCount;
L_INT nDetectedTablesCount;
L_INT nRet;
/* Load Bitmap */
nRet = L_LoadBitmap(MAKE_IMAGE_PATH(TEXT("Forms\\Forms to be Recognized\\Invoice\\Invoice.tif")), &LeadBitmap, sizeof(BITMAPHANDLE), 0, ORDER_BGR, NULL, NULL);
if (nRet != SUCCESS)
return nRet;
/* Set line detection options */
LinesDetectOptions.uStructSize = sizeof(DETECT_LINES_OPTIONS);
LinesDetectOptions.uHorizontalLineMinimumLength = 10;
LinesDetectOptions.uVerticalLineMinimumLength = 10;
LinesDetectOptions.uFlags = REMOVE_LINES;
/* Call detection, pass reference to output */
nRet = L_DetectLinesBitmap(&LeadBitmap, &LinesDetectOptions, &LinesDetectResult);
if (nRet != SUCCESS)
goto CLEANUP;
/* Number of vertical lines detected */
nVerticalLineCount = LinesDetectResult.VerticalLines.uCount;
/* First vertical line in output list */
FirstVerticalLine = LinesDetectResult.VerticalLines.pLines[0];
/* Save Bitmap to view lines removal */
L_SaveBitmap(MAKE_IMAGE_PATH(TEXT("Invoice_nolines.jpg")), &LeadBitmap, FILE_JPEG, 24, 0, NULL);
/* Set tables detection options */
TablesDetectOptions.uStructSize = sizeof(DETECT_TABLES_OPTIONS);
TablesDetectOptions.uHorizontalLineMinimumLength = 10;
TablesDetectOptions.uVerticalLineMinimumLength = 10;
/* Since we performed lines detection first, we can pass the detected lines to the tables option structure */
/* This will speed up the table detection */
TablesDetectOptions.pDetectedLines = &LinesDetectResult;
/* Perform Table detection */
nRet = L_DetectTablesBitmap(&LeadBitmap, &TablesDetectOptions, &TablesDetectResult);
if (nRet != SUCCESS)
goto CLEANUP;
nDetectedTablesCount = TablesDetectResult.uCount;
CLEANUP:
/* Free memory */
L_FreeDetectTablesBitmap(&TablesDetectResult);
L_FreeDetectLinesBitmap(&LinesDetectResult);
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