#include "Ltimgcor.h"
L_LTIMGCOR_API L_INT L_AutoPageSplitter(pBitmap, pOutBitmap, SplittingCoord)
Automatically splits document images that have two pages inside it.
Pointer to the bitmap handle referencing the bitmap to be splitted.
Pointer to a BITMAPHANDLE[2] array. The first element will be filled with the left page, and the second element with the right page.
Pointer to a L_UINT variable that will be filled with the column number of the splitting point.
Value | Meaning |
---|---|
SUCCESS | The function was successful. |
< 1 | An error occurred. Refer to Return Codes. |
Finds and splits a two-page document that has its pages horizontally side-by-side.
The two new bitmaps have the same dimensions as the original.
The new bitmaps are returned as 1-bit bitmaps.
This function can only process entire images. It does not support regions.
This function supports 24- and 36-bit color images and 8-bit grayscale images.
Required DLLs and Libraries
Win32, x64, Linux.
This example loads a two pages bitmap and applies the following filter to enhance document quality :- 1- Remove border 2- Split pages in bitmap 3- Expand the content of the page
L_INT AutoPageSplitterExample(L_VOID)
{
L_INT nRet;
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("ScannedBook.jpg")), &LeadBitmap, sizeof(BITMAPHANDLE), 0, ORDER_BGR, NULL, NULL);
if(nRet !=SUCCESS)
return nRet;
/* Apply border remove filter to clean up black borders*/
nRet = L_BorderRemoveBitmap(&LeadBitmap, NULL,NULL,NULL, BORDER_SMART_AUTO_REMOVE) ;
if (nRet != SUCCESS)
{
if(LeadBitmap.Flags.Allocated)
L_FreeBitmap(&LeadBitmap);
return nRet ;
}
/* Apply Page splitter*/
BITMAPHANDLE OutBitmap[2] ;
OutBitmap[0].Flags.Allocated = 0 ;
OutBitmap[1].Flags.Allocated = 0 ;
L_UINT SplitterCoordinates = 0 ;
nRet = L_AutoPageSplitter(&LeadBitmap, OutBitmap, &SplitterCoordinates) ;
if (nRet != SUCCESS)
{
if(LeadBitmap.Flags.Allocated)
L_FreeBitmap(&LeadBitmap);
return nRet ;
}
nRet = L_ExpandPage(&(OutBitmap[0]));
if (nRet == SUCCESS)
{
nRet = L_SaveBitmap(MAKE_IMAGE_PATH(TEXT("Result.BMP")), &(OutBitmap[0]), FILE_BMP, 24, 0, NULL);
}
if(OutBitmap[0].Flags.Allocated)
L_FreeBitmap(&OutBitmap[0]) ;
if(OutBitmap[1].Flags.Allocated)
L_FreeBitmap(&OutBitmap[1]) ;
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