L_AutoPageSplitter

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

Returns

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

LTIMGCOR

For a listing of the exact DLLs and Libraries needed, based on the toolkit version, refer to Files To Be Included With Your Application.

Platforms

Win32, x64, Linux.

See Also

Functions:

L_ExpandPage

Topics:

Raster Image Functions: Image Analysis

Processing an Image

Example

#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 ; 
} 

Help Version 19.0.2017.10.27
Products | Support | Contact Us | Copyright Notices
© 1991-2017 LEAD Technologies, Inc. All Rights Reserved.
LEADTOOLS Raster Imaging C API Help