Automatically segments the specified bitmap, finding the best segment combination without specifying minimum segment dimensions.
#include "ltwrappr.h"
L_INT LSegment::MrcSegmentBitmap(pBitmap, pSegOption)
Pointer to the bitmap object that references the bitmap to be segmented.
Pointer to the SEGMENTEXTOPTIONS structure that controls the automatic segmentation process. This cannot be NULL.
| Value | Meaning |
|---|---|
| SUCCESS | The function was successful. |
| < 1 | An error occurred. Refer to Return Codes. |
Call this function to segment the bitmap automatically. LEAD will process the bitmap and break it into appropriate picture, grayscale, text and background segments.
Call the LSegment::MrcStartBitmapSegmentation function before using any of the segmentation functions. When the LSegment class object is no longer needed, free it by calling the LSegment::MrcStopBitmapSegmentation function.
L_INT LSegment__MrcSegmentBitmapExample(LBitmap& LeadBitmap){LUserSeg segment ;SEGMENTEXTOPTIONS SegOpt;L_INT nRet = 0 ;memset(&SegOpt,0,sizeof(SegOpt));/* Specify the minimum segment width and height*/SegOpt.uStructSize = sizeof(SegOpt);SegOpt.uBackGroundThreshold = 10;SegOpt.uSegmentQuality = 50;SegOpt.uColorThreshold = 25;SegOpt.uCleanSize = 5;SegOpt.uCombineThreshold = 75;/* Start the segmentation process */nRet = segment.MrcStartBitmapSegmentation (&LeadBitmap, RGB(255, 255, 255), RGB(0, 0, 0));if(nRet == SUCCESS){/* do the auto-segmentation*/nRet = segment.MrcSegmentBitmap(&LeadBitmap, &SegOpt);if(nRet == SUCCESS){segment.EnableCallBack (TRUE);nRet = segment.MrcEnumSegments (0);segment.EnableCallBack(FALSE);/* end the segmentation process */nRet = segment.MrcStopBitmapSegmentation ();}}elsereturn nRet;return SUCCESS;}