←Select platform

DeleteSegment Method

Summary

Deletes a segment.

Syntax

C#
VB
C++
public void DeleteSegment(  
   int id 
) 
Public Sub DeleteSegment( _ 
   ByVal id As Integer _ 
) 
public: 
void DeleteSegment(  
   int id 
) 

Parameters

id
Segment identifier.

Remarks

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.

Example

C#
VB
Imports Leadtools 
Imports Leadtools.Codecs 
Imports Leadtools.Mrc 
 
<TestMethod()> _ 
Public Sub DeleteSegmentExample() 
   ' 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 segmenter As MrcSegmenter = New MrcSegmenter(image, RasterColor.FromKnownColor(RasterKnownColor.White), RasterColor.FromKnownColor(RasterKnownColor.Black)) 
   segmenter.SegmentImage(image, MrcSegmentImageOptions.Empty) 
 
   If segmenter.EnumerateSegments(Nothing) > 0 Then 
      segmenter.DeleteSegment(0) 
   End If 
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 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:\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