L_AutoPageSplitter

#include "Ltimgcor.h"

L_LTIMGCOR_API L_INT L_AutoPageSplitter(pBitmap, pOutBitmap, SplittingCoord)

Automatically splits document images that have two pages inside it.

Parameters

pBITMAPHANDLE pBitmap

Pointer to the bitmap handle referencing the bitmap to be splitted.

pBITMAPHANDLE 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.

L_UINT* SplittingCoord

Pointer to a L_UINT variable that will be filled with the column number of the splitting point.

Returns

Value Meaning
SUCCESS The function was successful.
< 1 An error occurred. Refer to Return Codes.

Comments

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

Platforms

Win32, x64, Linux.

See Also

Functions

Topics

Example

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 Version 21.0.2023.2.15
Products | Support | Contact Us | Intellectual Property Notices
© 1991-2021 LEAD Technologies, Inc. All Rights Reserved.

LEADTOOLS Raster Imaging C API Help

Products | Support | Contact Us | Intellectual Property Notices
© 1991-2021 LEAD Technologies, Inc. All Rights Reserved.