LBitmap::RakeRemove

#include "ltwrappr.h"

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

L_BOOL bAuto;

/* automation flag */

pRAKEREMOVE pRake;

/* pointer to RAKEREOVE structure */

RECT * pDstRect;

/* pointer to rake areas rectangles */

L_INT nRectCount;

/* number of rectangles */

L_UINT32 uFlags;

/* flags */

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

Parameter

Description

pAuto

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.

pRake

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

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.

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.

 

 

uFlags

Reserved for future use. Must be 0.

Returns

SUCCESS

The function was successful.

< 1

An error occurred. Refer to Return Codes.

Comments

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:

image\ebx_2010902079.gif

(Document) This function removes data rakes from scanned text documents. If the rakes pass through text, the pRake 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.

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.

See Also

Functions:

LBitmap::RakeRemoveCallBack, LBitmap::LineRemove, LBitmap::Smooth, LBitmap::BorderRemove, LBitmap::InvertedText, LBitmap::DotRemove, LBitmap::HolePunchRemove, LBitmap::BlankPageDetector, LBitmap::AutoBinarize, LBitmap::DynamicBinary, LBitmap::AutoBinary

Topics:

Raster Image Functions: Cleaning - up 1-Bit Images

 

Cleaning Up 1-Bit Images

Example

//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
{
public:
   LRakeRemoveBitmap();
   ~LRakeRemoveBitmap();
   virtual L_INT RakeRemoveCallBack(L_INT32        iLength
                                   );
};
LRakeRemoveBitmap::LRakeRemoveBitmap()
{
}
LRakeRemoveBitmap::~LRakeRemoveBitmap()
{
}
L_INT LRakeRemoveBitmap::RakeRemoveCallBack(L_INT32 iLength
                                            )
{
   CString strMsg;
   strMsg.Format(
      TEXT("Length[%d]\n"),
      iLength
      );
   OutputDebugString(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;
}