LSegment::MrcSegmentBitmap

#include "ltwrappr.h"

L_INT LSegment::MrcSegmentBitmap(pBitmap, pSegOption)

LBitmapBase * pBitmap;

/* pointer to a bitmap handle */

pSEGMENTEXTOPTIONS pSegOption;

/* pointer to a structure */

Automatically segments the specified bitmap, finding the best segment combination without specifying minimum segment dimensions.

Parameter

Description

pBitmap

Pointer to the bitmap object that references the bitmap to be segmented.

pSegOption

Pointer to the SEGMENTEXTOPTIONS structure that controls the automatic segmentation process. This cannot be NULL.

Returns

SUCCESS

The function was successful.

< 1

An error occurred. Refer to Return Codes.

Comments

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.

Required DLLs and Libraries

LTSGM

For a listing of the exact DLLs and Libraries needed, based on the toolkit version, refer to Files To Be Included With Your Application.

See Also

Functions:

LSegment::MrcStartBitmapSegmentation, LSegment::MrcStopBitmapSegmentation, LSegment::MrcSetSegmentData, LSegment::MrcEnumSegments, LSegment::MrcDeleteSegment, LSegment::MrcCombineSegments, LSegment::MrcSaveSegmentation, LSegment::MrcLoadSegmentation, LSegment::MrcCopySegmentationHandle, Class Members

Topics:

Auto-Segmentation

 

MRC Bitmap Functions: Automatic Segmentation

Example

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 ();
      }
   }
   else
      return nRet;
   return SUCCESS;
}