Removes the isolated data rakes from 1-bit black and white images.
Pointer to the bitmap handle that references the bitmap on which to perform rake removal.
Flag that indicates whether to automate the rakes removal. Possible values are:
|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.
Pointer to an array of Windows RECT structure specifying the areas where the rakes are in the image. If NULL is passed, the function will look for rakes in the entire image.
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 NULL is passed for the
pDstRect parameter, this parameter should be passed as 0.
Optional callback function for additional processing.
If you do not provide a callback function, use NULL as the value of this parameter.
If you do provide a callback function, use the function pointer as the value of this parameter.
The callback function must adhere to the function prototype described in RAKEREMOVECALLBACK function.
Void pointer that you can use to pass one or more additional parameters that the callback function needs.
To use this feature, assign a value to a variable or create a structure that contains as many fields as you need. Then, in this parameter, pass the address of the variable or structure, casting it to L_VOID *. The callback function, which receives the address in its own pUserData parameter, can cast it to a pointer of the appropriate data type to access your variable or structure.
If the additional parameters are not needed, you can pass NULL in this parameter.
Reserved for future use. Must be 0.
|SUCCESS||The function was successful.|
|< 1||An error occurred. Refer to Return Codes.|
A rake is a horizontal line with vertical partitioning lines pointing upward 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 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
This example loads a bitmap and applies the Rake Removal with specific rectangle areas on it then the Callback function prints the length of each comb found
L_INT EXT_CALLBACK RakeRemoveExampleCB( L_HRGN hRgn, L_INT Length, L_VOID* pUserData)
wsprintf(szMsg, TEXT("Length of Rake = %d"), Length);
MessageBox(NULL, szMsg, TEXT(""), MB_OK);
BITMAPHANDLE LeadBitmap; /*Bitmap handle to hold the loaded image*/
RECT rect ; /*Rectangle to specify area on Bitmap*/
RAKEREMOVE Rake; /*Rake structure*/
/* Load the bitmap, keeping the bits per pixel of the file */
nRet = L_LoadBitmap (MAKE_IMAGE_PATH(TEXT("Forms\\Forms to be Recognized\\OCR\\FCC-107_OCR_Filled.tif")),
&LeadBitmap, sizeof(BITMAPHANDLE), 0,
ORDER_BGR, NULL, NULL);
if(nRet != SUCCESS)
//Specify rectangle parameters
rect.left = 30;
rect.top = 30;
rect.bottom = 60;
rect.right = 60;
rect.left = 70;
rect.top = 70;
rect.bottom = 100;
rect.right = 100;
//specifying comb structure parameters
Rake.nMaxMidteethLength = 50;
Rake.nMaxSideteethLength = 60;
Rake.nMaxWallPercent = 25;
Rake.nMaxWidth = 3;
Rake.nMinLength = 50;
Rake.nMinWallHeight = 10;
Rake.nTeethSpacing = 5;
Rake.nVariance = 1;
Rake.nGaps = 1;
//Apply the RakeRemove function
nRet = L_RakeRemoveBitmap(&LeadBitmap,TRUE, &Rake,rect, 2, RakeRemoveExampleCB,NULL, 0);
if(nRet != SUCCESS)
/* Free the region */
/* Free the bitmap */
Medical Web Viewer .NET
.NET, Java, Android, and iOS/macOS Assemblies
C API/C++ Class Libraries