LSegment::MrcSegmentBitmap

Summary

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

Syntax

#include "ltwrappr.h"

L_INT LSegment::MrcSegmentBitmap(pBitmap, pSegOption)

Parameters

LBitmapBase * pBitmap

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

pSEGMENTEXTOPTIONS pSegOption

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

Returns

Value Meaning
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

See Also

Functions

Topics

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; 
} 
Help Version 23.0.2024.2.29
Products | Support | Contact Us | Intellectual Property Notices
© 1991-2024 LEAD Technologies, Inc. All Rights Reserved.

LEADTOOLS MRC C++ Class Library Help
Products | Support | Contact Us | Intellectual Property Notices
© 1991-2023 LEAD Technologies, Inc. All Rights Reserved.