LSegment::MrcCombineSegments

#include "ltsgm.h"

L_INT LSegment::MrcCombineSegments(nSegId1, nSegId2, uCombineFlags, uCombineFactor)

Combines two segments.

Parameters

L_INT nSegId1

ID of the first segment to be combined.

L_INT nSegId2

ID of the second segment to be combined.

L_UINT16 uCombineFlags

Flag that indicates how segments will be combined. Possible values are:

Value Meaning
COMBINE_FORCE [0x00] Always combine segments of any type.
COMBINE_FORCESIMILAR [0x01] Always combine similar segments.
COMBINE_TRY [0x02] Use the uCombineFactor value to determine similarity, and combine similar segments.

For the COMBINE_FORCESIMILAR value, the following types are considered similar and could therefore be combined:

SEGTYPE_ONECOLOR, SEGTYPE_BACKGROUND, SEGTYPE_TEXT_1BIT_BW, SEGTYPE_TEXT_2BITBW, SEGTYPE_TEXT_1BIT_COLOR, SEGTYPE_TEXT_2BIT_COLOR, or SEGTYPE_GRAYSCALE_2BIT

These types are considered similar and therefore could be combined:

SEGTYPE_GRAYSCALE_2BIT or SEGTYPE_GRAYSCALE_8BIT

These types are considered similar and therefore could be combined:

SEGTYPE_GRAYSCALE_8BIT or SEGTYPE_PICTURE

L_UINT16 uCombineFactor

A percentage value that represents the acceptable difference between the two segments being combined. This is valid only when uCombineFlags is COMBINE_TRY. Possible values are between 0 and 100. A value of 0 indicates that only segments that are an exact match can be combined. A value of 100 indicates that any two segments of the same type can be combined. Large values cause very different segments to be joined, which causes considerable quality loss.

Returns

Value Meaning
SUCCESS The function was successful.
< 1 An error occurred. Refer to Return Codes.

Comments

This function is used to combine two specific segments from the segmentation handle. The two segments must be in the same row or column to be combined.

This function can be used when performing automatic or manual segmentation.

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

Elements

Topics

Example

L_INT LSegment__MrcCombineSegmentsExample(LSegment Segment, L_INT nSegId1, L_INT nSegId2) 
{ 
   L_INT nRet; 
 
   nRet = Segment.MrcCombineSegments(nSegId1, nSegId2, COMBINE_FORCE, 20); 
   if(nRet != SUCCESS) 
      return nRet; 
 
   return SUCCESS; 
} 
Help Version 20.0.2019.11.25
Products | Support | Contact Us | Intellectual Property Notices
© 1991-2020 LEAD Technologies, Inc. All Rights Reserved.

LEADTOOLS MRC C++ Class Library Help