LBitmap::LineRemove

#include "ltwrappr.h"

virtual L_INT LBitmap::LineRemove(pLineRemove, uFlags = 0)

Removes horizontal and vertical lines in a 1-bit black and white image.

Parameters

pLINEREMOVE pLineRemove

Pointer to the LINEREMOVE structure that LEADTOOLS uses to perform the line removal operation.

L_UINT32 uFlags

Reserved for future use. Must be 0.

Returns

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

Comments

This function removes horizontal and vertical lines from scanned text documents. If the lines pass through text, the pLineRemove parameter can be configured to remove or preserve the text.

This function works only on 1-bit black and white images.

If a region is selected, only the selected region will be changed by this function. If no region is selected, the whole image will be processed.

The behavior of this function can be further modified by overriding LBitmap::LineRemoveCallback.

This function does not support signed data images. It returns the error code ERROR_SIGNED_DATA_NOT_SUPPORTED if a signed data image is passed to this function.

This function does not support 32-bit grayscale images. It returns the error code ERROR_GRAY32_UNSUPPORTED if a 32-bit grayscale image is passed to this function.

Required DLLs and Libraries

Platforms

Win32, x64.

See Also

Functions

Topics

Example

This example removes vertical lines that are at least 200 pixels in length
and no more than 5 pixels in width
The lines can have gaps up to two pixels in length.
The derived class LMyBitmap is used to override the LineRemoveCallBack function.
myBitmap is an object of class LMyBitmap.
The callback member function is used to display information about each line removed.
The callback member function does NOT receive a Windows region.

class LLineRemoveBitmap : public LBitmap 
{ 
public: 
   LLineRemoveBitmap(); 
   ~LLineRemoveBitmap(); 
 
   virtual L_INT LineRemoveCallBack(L_UINT32       uBumpOrNick, 
                                    L_INT32        iStartRow,  
                                    L_INT32        iStartCol,  
                                    L_INT32        iLength, 
                                    L_UINT32       uHorV 
                                    ); 
}; 
 
LLineRemoveBitmap::LLineRemoveBitmap() 
{ 
} 
 
LLineRemoveBitmap::~LLineRemoveBitmap() 
{ 
} 
 
L_INT LLineRemoveBitmap::LineRemoveCallBack(L_UINT32 uBumpOrNick, 
                                             L_INT32 iStartRow,  
                                             L_INT32 iStartCol,  
                                             L_INT32 iLength, 
                                             L_UINT32 uHorV 
                                             ) 
{ 
   UNREFERENCED_PARAMETER(uHorV); 
   UNREFERENCED_PARAMETER(uBumpOrNick); 
 
   CString strMsg; 
 
  strMsg.Format( 
     TEXT("RowCol[%d,%d] Length[%d]\n"), 
     iStartRow, 
     iStartCol, 
     iLength 
     ); 
  OutputDebugString(strMsg); 
  return SUCCESS_REMOVE;  
} 
 
L_INT LBitmap__LineRemoveExample(LBitmapWindow *pBitmapWindow) 
{ 
   LINEREMOVE        lr; 
 
   lr.uStructSize    = sizeof(LINEREMOVE); 
   lr.uBitmapStructSize        = sizeof(BITMAPHANDLE); 
   lr.iGapLength     = 2; 
   lr.iMaxLineWidth  = 5; 
   lr.iMinLineLength = 200; 
   lr.iWall          = 7; 
   lr.iMaxWallPercent   = 10; 
   lr.uRemoveFlags   = LINEREMOVE_HORIZONTAL; 
   lr.uFlags         = LINE_USE_GAP; 
   lr.pBitmapRegion  = NULL; 
 
   pBitmapWindow->LineRemove(&lr); 
 
   return SUCCESS; 
} 

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

LEADTOOLS Raster Imaging C++ Class Library Help

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