LEADTOOLS MRC (Leadtools.Mrc assembly)
LEAD Technologies, Inc

AddSegment Method

Example 





The image in which the segment will be created.
Information about the segment that will be added.
Adds a new segment manually and sets the segment information.
Syntax
public int AddSegment( 
   RasterImage image,
   MrcSegmentData data
)
'Declaration
 
Public Function AddSegment( _
   ByVal image As RasterImage, _
   ByVal data As MrcSegmentData _
) As Integer
'Usage
 
Dim instance As MrcSegmenter
Dim image As RasterImage
Dim data As MrcSegmentData
Dim value As Integer
 
value = instance.AddSegment(image, data)
public int AddSegment( 
   RasterImage image,
   MrcSegmentData data
)
 function Leadtools.Mrc.MrcSegmenter.AddSegment( 
   image ,
   data 
)
public:
int AddSegment( 
   RasterImage^ image,
   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
 
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, "Master.jpg"))
      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
public void AddSegmentExample()
   {
      // Load an image
      RasterCodecs codecs = new RasterCodecs();
      codecs.ThrowExceptionsOnInvalidImages = true;

      RasterImage image = codecs.Load(Path.Combine(LEAD_VARS.ImagesDir,"Master.jpg"));

      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: Windows 7, Windows Vista SP1 or later, Windows XP SP3, Windows Server 2008 (Server Core not supported), Windows Server 2008 R2 (Server Core supported with SP1 or later), Windows Server 2003 SP2

See Also

Reference

MrcSegmenter Class
MrcSegmenter Members
SegmentImage Method
DeleteSegment Method
CombineSegments Method
Clone Method
Programming with LEADTOOLS MRC

 

 


Products | Support | Contact Us | Copyright Notices

© 2006-2012 All Rights Reserved. LEAD Technologies, Inc.

Leadtools.Mrc requires a Document or Medical toolkit license and unlock key. For more information, refer to: LEADTOOLS Toolkit Features