LSegment::MrcCombineSegments

#include "ltsgm.h"

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

L_INT nSegId1;

/* first segment identifier */

L_INT nSegId2;

/* second segment identifier */

L_UINT16 uCombineFlags;

/* combining flag */

L_UINT16 uCombineFactor;

/* combining quality factor */

Combines two segments.

Parameter

Description

nSegId1

ID of the first segment to be combined.

nSegId2

ID of the second segment to be combined.

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

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

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

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

Elements:

LSegment::MrcCreateNewSegment, LSegment::MrcDeleteSegment, LSegment::MrcSegmentBitmap, Class Members

Topics:

General Segmentation

 

Manual Segmentation

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;
}