Updates the specified segment.
Syntax
Parameters
- image
- The image that will be segmented.
- id
- ID of the segment to be updated.
- data
- Instance of the structure that contains the new segment information.
Example
Visual Basic | Copy Code |
---|
Private segmentedImage As RasterImage
Private Function MrcEnumerateSegmentInfoSetSegmentDataCallback(ByVal segmentHandle As MrcSegmenter, ByVal data As MrcSegmentData, ByVal iD As Integer) As Boolean
If iD = 0 Then
Dim newData As MrcSegmentData = data
newData.ImageSegment = New System.Drawing.Rectangle(0, 0, 60, 60)
newData.SegmentType = MrcSegmentType.Picture
End If
Return True
End Function
<Test> _
Public Sub SetSegmentDataExample()
RasterCodecs.Startup()
Dim codecs As RasterCodecs = New RasterCodecs()
codecs.ThrowExceptionsOnInvalidImages = True
Dim image As RasterImage = codecs.Load("C:\Program Files\LEAD Technologies\LEADTOOLS 15\Images\Master.jpg")
Dim segmenter As MrcSegmenter = New MrcSegmenter(image, Color.White, Color.Black)
segmenter.SegmentImage(image, MrcSegmentImageOptions.Empty)
Dim setSegmentCallBack As MrcEnumerateSegmentsInfo = New MrcEnumerateSegmentsInfo(AddressOf MrcEnumerateSegmentInfoSetSegmentDataCallback)
segmenter.EnumerateSegments(setSegmentCallBack)
End Sub |
C# | Copy Code |
---|
private bool MrcEnumerateSegmentInfoSetSegmentDataCallback(MrcSegmenter segmentHandle, MrcSegmentData data, int iD) { if (iD == 0) { MrcSegmentData newData = data; newData.ImageSegment = new System.Drawing.Rectangle(0, 0, 60, 60); newData.SegmentType = MrcSegmentType.Picture; //segmenter.SetSegmentData(segmentedImage, iD, newData); } return true; } public void SetSegmentDataExample() { // Load an image RasterCodecs.Startup(); RasterCodecs codecs = new RasterCodecs(); codecs.ThrowExceptionsOnInvalidImages = true; RasterImage image = codecs.Load(@"C:\Program Files\LEAD Technologies\LEADTOOLS 15\Images\Master.jpg"); MrcSegmenter segmenter = new MrcSegmenter(image, Color.White, Color.Black); segmenter.SegmentImage(image, MrcSegmentImageOptions.Empty); MrcEnumerateSegmentsInfo setSegmentCallBack = new MrcEnumerateSegmentsInfo(MrcEnumerateSegmentInfoSetSegmentDataCallback); segmenter.EnumerateSegments(setSegmentCallBack); } |
Remarks
Requirements
Target Platforms: Microsoft .NET Framework 2.0, Windows 98, Windows NT 4.0, Windows Millennium Edition, Windows 2000, Windows XP Home Edition, Windows XP Professional, Windows Server 2003 family
See Also