L_MrcSetSegmentData

#include "ltsgm.h"

L_LTSGM_API L_INT L_MrcSetSegmentData(hSegment, pBitmap, nSegId, pSegmentData)

HSEGMENTATION hSegment;

segmentation handle

pBITMAPHANDLE pBitmap;

pointer to the bitmap handle

L_INT nSegId;

segment identifier

pSEGMENTDATA pSegmentData;

pointer to a structure

Updates the specified segment.

Parameter

Description

hSegment

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

pBitmap

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

nSegId

ID of the segment to be updated.

pSegmentData

Pointer to the SEGMENTDATA structure that contains the new segment information.

Returns

SUCCESS

The function was successful.

< 1

An error occurred. Refer to Return Codes.

Comments

Use this function to update the segment information. In the automatic segmentation mode, the LEADTOOLS engine will update the segments using the new segment data passed to this function. This process may create or delete segments. The function will update the segments so they remain within the bitmap width and height.

In the manual segmentation mode, the user is free to update the segments. The LEADTOOLS engine will not delete or create segments. If an error occurs, the pSegmentData parameter will be updated with the target segment.

To get segment IDs and segment information, use the L_MrcEnumSegments function to enumerate all segments.

The function will return an error if the updated segment exceeds its image boundaries.

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

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:

L_MrcStartBitmapSegmentation, L_MrcStopBitmapSegmentation, L_MrcDeleteSegment, L_MrcEnumSegments, L_MrcCombineSegments, L_MrcSaveSegmentation, L_MrcLoadSegmentation, L_MrcCopySegmentationHandle, L_MrcSegmentBitmap

Topics:

Auto-Segmentation

 

Manual Segmentation

 

MRC Bitmap Functions: Manipulating Segments

Example

Update segment example.

L_INT EXT_CALLBACK EnumSegmentCallBack(HSEGMENTATION        hSegmentation, 
const pSEGMENTDATA   pSegment, 
L_INT                nSegId, 
L_VOID*              pUserData) 
{ 
   UNREFERENCED_PARAMETER(hSegmentation); 
   UNREFERENCED_PARAMETER(pUserData); 
   L_UINT SegArea; 
   L_TCHAR szSegmentId[256]; 
   memset(szSegmentId, 0, 256); 
   wsprintf(szSegmentId, TEXT("Error Segment size in Segment %d"), nSegId); 
   SegArea = (pSegment->rcBitmapSeg.bottom - pSegment->rcBitmapSeg.top) * 
   (pSegment->rcBitmapSeg.right - pSegment->rcBitmapSeg.left); 
   if(SegArea == 0) 
      MessageBox(NULL, szSegmentId, TEXT("Error"), MB_OK); 
   return SUCCESS; 
} 
L_INT MrcSetSegmentDataExample(HSEGMENTATION hSegmentation, 
pBITMAPHANDLE pBitmap, 
pSEGMENTDATA  pNewSegmentData, 
L_INT         nSegId) 
{ 
   L_INT nRet; 
   /* update the segments based on the new segment */ 
   nRet = L_MrcSetSegmentData (hSegmentation, pBitmap, nSegId, pNewSegmentData); 
   if (nRet != SUCCESS) 
      return nRet; 
   /* Enumerate the new segments and their id's */ 
   L_MrcEnumSegments (hSegmentation, (pMRCENUMSEGMENTSPROC)&EnumSegmentCallBack, NULL, 0); 
   /* Delete a segment */ 
   nRet = L_MrcDeleteSegment (hSegmentation, nSegId); 
   if (nRet != SUCCESS) 
      return nRet; 
   /* Enumerate the new segments and their id's */ 
   L_MrcEnumSegments(hSegmentation, (pMRCENUMSEGMENTSPROC)&EnumSegmentCallBack, NULL, 0); 
   return nRet; 
} 

Help Version 19.0.2017.10.27
Products | Support | Contact Us | Copyright Notices
© 1991-2017 LEAD Technologies, Inc. All Rights Reserved.
LEADTOOLS Mixed Raster Content (MRC) C API Help