#include "ltsgm.h"
L_LTSGM_API L_INT L_MrcCombineSegments(hSegment, nSegId1, nSegId2, uCombineFlags, uCombineFactor)
Combines two segments.
An existing segmentation handle. This handle is obtained by calling the L_MrcStartBitmapSegmentation function.
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. |
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
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 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
L_INT MrcCombineSegmentsExample(HSEGMENTATION hSegmentation,
L_INT nSegId1,
L_INT nSegId2)
{
return L_MrcCombineSegments(hSegmentation,
nSegId1,
nSegId2,
COMBINE_FORCE,
20);
}