Initializes a new ObjectCounterCommand with explicit parameters.
Syntax
Parameters
- objectrectangle
- Rectangle surrounding the object.
- objectdata
- Two dimension array containing the location of the pixels belonging
to the object. Elements in the array with value 1 belong to the object, otherwise they do not
Example
Run the ObjectCounterCommand on an image.
Visual Basic | Copy Code |
---|
Public WithEvents objectCounterCommand_S2 As ObjectCounterCommand
Public Sub ObjectCounterCommandEventArgsExample()
RasterCodecs.Startup()
Dim codecs As New RasterCodecs()
codecs.ThrowExceptionsOnInvalidImages = True
Dim leadImage As RasterImage = codecs.Load(LeadtoolsExamples.Common.ImagesPath.Path + "Clean.tif")
objectCounterCommand_S2 = New ObjectCounterCommand
objectCounterCommand_S2.Run(leadImage)
RasterCodecs.Shutdown()
End Sub
Private Sub ObjectCounterCommand_ObjectCounter_S2(ByVal sender As Object, ByVal e As ObjectCounterCommandEventArgs) Handles objectCounterCommand_S2.ObjectCounter
Dim ee As ObjectCounterCommandEventArgs = New ObjectCounterCommandEventArgs(e.ObjectRectangle, e.ObjectData)
End Sub |
C# | Copy Code |
---|
public void ObjectCounterCommandEventArgsExample() { // Load an image RasterCodecs.Startup(); RasterCodecs codecs = new RasterCodecs(); codecs.ThrowExceptionsOnInvalidImages = true; RasterImage image =codecs.Load( "D:\\Lead15\\images2\\LEADTOOLS Images\\Master.jpg"); // Prepare the command ObjectCounterCommand command = new ObjectCounterCommand(); command.ObjectCounter += new EventHandler<ObjectCounterCommandEventArgs>(ObjectCounterEvent_S2); command.Run(image); RasterCodecs.Shutdown(); } private void ObjectCounterEvent_S2(object sender, ObjectCounterCommandEventArgs e) { ObjectCounterCommandEventArgs ee = new ObjectCounterCommandEventArgs(e.ObjectRectangle, e.ObjectData); } |
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