←Select platform

AddSegment Method

Summary

Adds a new segment manually and sets the segment information.

Syntax

C#
VB
C++
public int AddSegment(  
   Leadtools.RasterImage image, 
   Leadtools.Mrc.MrcSegmentData data 
) 
Public Function AddSegment( _ 
   ByVal image As Leadtools.RasterImage, _ 
   ByVal data As Leadtools.Mrc.MrcSegmentData _ 
) As Integer 
public: 
int AddSegment(  
   Leadtools.RasterImage^ image, 
   Leadtools.Mrc.MrcSegmentData data 
) 

Parameters

image
The image in which the segment will be created.

data
Information about the segment that will be added.

Remarks

This method adds a new segment using the coordinates and the type specified in the data parameter.

Example

C#
VB
Imports Leadtools 
Imports Leadtools.Codecs 
Imports Leadtools.Mrc 
 
<TestMethod()> _ 
Public Sub AddSegmentExample() 
   ' Load an image 
   Dim codecs As RasterCodecs = New RasterCodecs() 
   codecs.ThrowExceptionsOnInvalidImages = True 
   Dim image As RasterImage = codecs.Load(Path.Combine(LEAD_VARS.ImagesDir, "PDFSegmentation.pdf")) 
   Dim data As MrcSegmentData = MrcSegmentData.Empty 
 
   Dim mrcSegmenter As 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) 
End Sub 
 
Public NotInheritable Class LEAD_VARS 
Public Const ImagesDir As String = "C:\Users\Public\Documents\LEADTOOLS Images" 
End Class 
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:\Users\Public\Documents\LEADTOOLS Images"; 
} 

Requirements

Target Platforms

Products | Support | Contact Us | Copyright Notices
© 1991-2017 LEAD Technologies, Inc. All Rights Reserved.
Leadtools.Mrc Assembly
Click or drag to resize