CombineSegments Method (original) (raw)
Summary
Combines two segments.
Syntax
Parameters
id1
ID of the first segment to be combined.
id2
ID of the second segment to be combined.
factor
A percentage value that represents the acceptable difference between the two segments being combined. This is valid only when flags is set to TryFactor. 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.
Example
using Leadtools;
using Leadtools.Codecs;
using Leadtools.Mrc;
public void CombineSegmentsExample()
{
// Load an image
RasterCodecs codecs = new RasterCodecs();
codecs.ThrowExceptionsOnInvalidImages = true;
RasterImage image = codecs.Load(Path.Combine(LEAD_VARS.ImagesDir, "MRCSegmentation.mrc"));
MrcSegmenter segmenter = new MrcSegmenter(image, Path.Combine(LEAD_VARS.ImagesDir, "MRCSegmentation.sgm"));
segmenter.CombineSegments(0, 1, MrcCombineSegmentFlags.CombineForce, 20);
}
static class LEAD_VARS
{
public const string ImagesDir = @"C:\LEADTOOLS22\Resources\Images";
}