L_MrcCombineSegments

#include "ltsgm.h"

L_LTSGM_API L_INT L_MrcCombineSegments(hSegment, nSegId1, nSegId2, uCombineFlags, uCombineFactor)

HSEGMENTATION hSegment;

/* segmentation handle */

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. This function is available in the (Document/Medical) toolkits.

Parameter

Description

hSegment

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

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 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_MrcCreateNewSegment, L_MrcStartBitmapSegmentation, L_MrcStopBitmapSegmentation, L_MrcSetSegmentData, L_MrcEnumSegments, L_MrcSaveSegmentation, L_MrcLoadSegmentation, L_MrcCopySegmentationHandle, L_MrcSegmentBitmap

Topics:

Auto-Segmentation

 

Manual Segmentation

 

MRC Bitmap Functions: Manipulating Segments

Example

L_INT MrcCombineSegmentsExample(HSEGMENTATION   hSegmentation,
                                               L_INT           nSegId1,
                                               L_INT           nSegId2)
{
   return L_MrcCombineSegments(hSegmentation,
                               nSegId1,
                               nSegId2,
                               COMBINE_FORCE,
                               20);
}