This method is used to delete a specific segment from the segmentation handle. This method is valid with the auto and manual segmentation process. For more information, refer to Programming with LEADTOOLS MRC.
using Leadtools;
using Leadtools.Codecs;
using Leadtools.Mrc;
public void DeleteSegmentExample()
{
// Load an image
RasterCodecs codecs = new RasterCodecs();
codecs.ThrowExceptionsOnInvalidImages = true;
RasterImage image = codecs.Load(Path.Combine(LEAD_VARS.ImagesDir, "PDFSegmentation.pdf"));
MrcSegmenter segmenter = new MrcSegmenter(image, RasterColor.FromKnownColor(RasterKnownColor.White), RasterColor.FromKnownColor(RasterKnownColor.Black));
segmenter.SegmentImage(image, MrcSegmentImageOptions.Empty);
if (segmenter.EnumerateSegments(null) > 0)
segmenter.DeleteSegment(0);
}
static class LEAD_VARS
{
public const string ImagesDir = @"C:\LEADTOOLS23\Resources\Images";
}