Initializes a new
ObjectInformationCommand class object with default parameters.
Syntax
Visual Basic (Declaration) | |
---|
Public Function New() |
C# | |
---|
public ObjectInformationCommand() |
C++/CLI | |
---|
public:
ObjectInformationCommand(); |
Example
Run the ObjectInformationCommand on an image.
Visual Basic | Copy Code |
---|
Public Sub ObjectInformationConstructorExample()
RasterCodecs.Startup()
Dim codecs As New RasterCodecs()
codecs.ThrowExceptionsOnInvalidImages = True
Dim leadImage As RasterImage = codecs.Load(LeadtoolsExamples.Common.ImagesPath.Path + "Master.jpg")
Dim command As ObjectInformationCommand = New ObjectInformationCommand
command.Weighted = False
command.Run(leadImage)
MessageBox.Show("Angle = " + command.Angle.ToString + Chr(13) + _
"Roundness = " + command.Roundness.ToString + Chr(13) + _
"X = " + command.CenterOfMass.X.ToString + Chr(13) + _
"Y = " + command.CenterOfMass.Y.ToString)
RasterCodecs.Shutdown()
End Sub |
C# | Copy Code |
---|
public void ObjectInformationConstructorExample() { // Load an image RasterCodecs.Startup(); RasterCodecs codecs = new RasterCodecs(); codecs.ThrowExceptionsOnInvalidImages = true; RasterImage image = codecs.Load(LeadtoolsExamples.Common.ImagesPath.Path + "Master.jpg"); // Prepare the command // Get the objects center of mass and it's roundness. I am not interested in the axis' orientation, so I pass NULL_ ObjectInformationCommand command = new ObjectInformationCommand(); command.Weighted = false; command.Run(image); MessageBox.Show("Angle = " + command.Angle + "\n" + "Roundness = " + command.Roundness + "\n" + "X = " + command.CenterOfMass.X + "\n" + "Y = " + command.CenterOfMass.Y); RasterCodecs.Shutdown(); } |
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