L_MrcCreateNewSegment

Summary

Manually adds a new segment and sets the segment information.

Syntax

#include "ltsgm.h"

L_LTSGM_API L_INT L_MrcCreateNewSegment(hSegment, pBitmap, pSegment)

Parameters

HSEGMENTATION hSegment

An existing segmentation handle. This handle is obtained by calling the L_MrcStartBitmapSegmentation function.

pBITMAPHANDLE pBitmap

Pointer to the bitmap in which the segment will be created.

pSEGMENTDATA pSegment

Pointer to the SEGMENTDATA structure that contains the segment information.

Returns

Value Meaning
>= 0 Index of the newly added segment. The function was successful.
< 0 An error occurred. Refer to Return Codes.

Comments

Use this function to manually add a new segment using the coordinates and type specified in pSegment.

Call the L_MrcStartBitmapSegmentation function before using any of the segmentation functions. When the handle to the segmentation is no longer needed, free it by calling the L_MrcStopBitmapSegmentation function.

Required DLLs and Libraries

See Also

Functions

Topics

Example

Manual segmentation example.

L_INT MrcCreateNewSegmentExample(pBITMAPHANDLE pBitmap) 
{ 
   L_INT          nRet; 
   HSEGMENTATION  hSegmentation; 
   SEGMENTDATA    Segment; 
 
   /* start the segmentation process */ 
   nRet = L_MrcStartBitmapSegmentation (&hSegmentation, pBitmap, RGB(255, 255, 255), RGB(0, 0, 0)); 
   if (nRet != SUCCESS) 
      return nRet; 
 
   memset(&Segment, 0, sizeof(SEGMENTDATA)); 
   Segment.uStructSize = sizeof(SEGMENTDATA); 
   SetRect(&Segment.rcBitmapSeg, 20, 20, 60, 60); 
   Segment.uType = SEGTYPE_PICTURE; 
 
   /* Create a new segment */ 
   nRet = L_MrcCreateNewSegment(hSegmentation, pBitmap, &Segment); 
   if (nRet < 0) 
      return nRet; 
 
   /* End the segmentation process */ 
   nRet = L_MrcStopBitmapSegmentation (hSegmentation); 
   if (nRet != SUCCESS) 
      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 Mixed Raster Content (MRC) C API Help
Products | Support | Contact Us | Intellectual Property Notices
© 1991-2023 LEAD Technologies, Inc. All Rights Reserved.