Combines two segments.
#include "ltsgm.h"
L_INT LSegment::MrcCombineSegments(nSegId1, nSegId2, uCombineFlags, uCombineFactor)
ID of the first segment to be combined.
ID of the second segment to be combined.
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. |
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
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.
Value | Meaning |
---|---|
SUCCESS | The function was successful. |
< 1 | An error occurred. Refer to Return Codes. |
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.
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;
}