#include "Ltimgcor.h"
L_LTIMGCOR_API L_INT L_AutoPageSplitter(pBitmap, pOutBitmap, SplittingCoord)
pBITMAPHANDLE pBitmap; |
pointer to the bitmap handle |
pBITMAPHANDLE pOutBitmap; |
pointer to a BITMAPHANDLE[2] array. |
L_UINT* SplittingCoord; |
pointer to a L_UINT variable that will be filled with the column number of the splitting point |
Automatically splits document images that have two pages inside it.
Parameter |
Description |
pBitmap |
Pointer to the bitmap handle referencing the bitmap to be splitted. |
pOutBitmap |
Pointer to a BITMAPHANDLE[2] array. The first element will be filled with the left page, and the second element with the right page. |
SplittingCoord |
Pointer to a L_UINT variable that will be filled with the column number of the splitting point. |
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
For a listing of the exact DLLs and Libraries needed, based on the toolkit version, refer to Files To Be Included With Your Application. |
Win32, x64, Linux.
Functions: |
|
Topics: |
|
Processing an Image |
#define MAKE_IMAGE_PATH(pFileName) TEXT("C:\\Users\\Public\\Documents\\LEADTOOLS Images\\")pFileName
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 ;
}
Raster .NET | C API | C++ Class Library | JavaScript HTML5
Document .NET | C API | C++ Class Library | JavaScript HTML5
Medical .NET | C API | C++ Class Library | JavaScript HTML5
Medical Web Viewer .NET