Removes the isolated data rakes from 1-bit black and white images.


#include "ltwrappr.h"

virtual L_INT LBitmap::RakeRemove (bAuto, pRakeRemove, pDstRect, nRectCount, uFlags = 0)


L_BOOL bAuto

Flag that indicates whether to automate the rakes removal. Possible values are:

Value Meaning
TRUE Automate the rakes removal.
FALSE Do not automate the rakes removal.


Pointer to the RAKEREMOVE structure that LEADTOOLS uses to perform the rake removal operation.

RECT * pDstRect

Pointer to an array of Windows RECT structure specifying the areas where the rakes are in the image. If the parameter is passed as NULL, the function will look for rakes in the entire image.

L_INT nRectCount

Number of rectangles specified which equals to the number of rakes in an image or more if one rectangle contains more than one rake. If the parameter pDstRect is passed as NULL this parameter should be passed as 0.

L_UINT32 uFlags

Reserved for future use. Must be 0.


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


A rake is a horizontal line with vertical partitioning lines pointing upwards attached to it. Rakes are used to contain data (digits or characters) filled individually and separated by the spaces created by the partitioning vertical lines.

A typical rake looks like the following:


(Document) This function removes data rakes from scanned text documents. If the rakes pass through text, the pRakeRemove parameter can be configured to remove or preserve the text. The behavior of this function can be further modified by using its callback.

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

For rake structures that are inside or part of tables, the user can select the rake structure and the rake structure only- via region (preferably a rectangular region) and call the function on that region.

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

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.

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.

Rake Remove Function - Before

Rake Remove Function - Before

Rake Remove Function - After

Rake Remove Function - After

View additional platform support for this Rake Remove function.

Required DLLs and Libraries


Win32, x64.

See Also




This example removes rakes that are at least 50 pixels in length
and no more than 3 pixels in width
The rakes can have gaps up to one pixel in length.
The callback member function is used to show the length of each removed rake
The callback member function does NOT receive a Windows region.

class LRakeRemoveBitmap : public LBitmap 
   virtual L_INT RakeRemoveCallBack(L_INT32        iLength 
L_INT LRakeRemoveBitmap::RakeRemoveCallBack(L_INT32 iLength) 
   CString strMsg; 
   return SUCCESS_REMOVE;  
L_INT LBitmap__RakeRemoveExample(LBitmapWindow *pBitmapWindow) 
   RAKEREMOVE        rr; 
   L_BOOL bAuto = FALSE; 
   rr.nMinLength        = 50; 
   rr.nMaxWidth         = 3; 
   rr.nMinWallHeight    = 10; 
   rr.nMaxWallPercent   = 25; 
   rr.nMaxMidteethLength   = 20; 
   rr.nMaxSideteethLength  = 25; 
   rr.nGaps                = 1; 
   rr.nVariance            = 2; 
   rr.nTeethSpacing        = 5; 
   pBitmapWindow->RakeRemove( bAuto, &rr, NULL, 0, 0); 
   return SUCCESS; 

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

LEADTOOLS Raster Imaging C++ Class Library Help