AddSegment Method (original) (raw)

Summary

Adds a new segment manually and sets the segment information.

Syntax

Parameters

image
The image in which the segment will be created.

data
Information about the segment that will be added.

Example

using Leadtools; using Leadtools.Codecs; using Leadtools.Mrc; public void AddSegmentExample() { // Load an image RasterCodecs codecs = new RasterCodecs(); codecs.ThrowExceptionsOnInvalidImages = true; RasterImage image = codecs.Load(Path.Combine(LEAD_VARS.ImagesDir, "PDFSegmentation.pdf")); MrcSegmentData data = MrcSegmentData.Empty; MrcSegmenter mrcSegmenter = new MrcSegmenter(image, RasterColor.FromKnownColor(RasterKnownColor.White), RasterColor.FromKnownColor(RasterKnownColor.Black)); data.ImageSegment = new LeadRect(0, 0, 20, 60); data.SegmentType = MrcSegmentType.Picture; mrcSegmenter.AddSegment(image, data); } static class LEAD_VARS { public const string ImagesDir = @"C:\LEADTOOLS22\Resources\Images"; }