←Select platform

ObjectCounterCommandEventArgs Class

Summary
Handles each object found by the ObjectCounterCommand.
Syntax
C#
C++/CLI
Python
public class ObjectCounterCommandEventArgs : EventArgs 
public ref class ObjectCounterCommandEventArgs : public System.EventArgs  
class ObjectCounterCommandEventArgs(EventArgs): 
Example

Runs the ObjectCounterCommand on an image.

C#
using Leadtools; 
using Leadtools.Codecs; 
using Leadtools.ImageProcessing.Core; 
 
 
public void ObjectCounterCommandEventArgsExample() 
{ 
   // Load an image 
   RasterCodecs codecs = new RasterCodecs(); 
   codecs.ThrowExceptionsOnInvalidImages = true; 
 
   RasterImage image = codecs.Load(Path.Combine(LEAD_VARS.ImagesDir, @"Black-White-Objects-1BitPP.tif")); 
 
   // Prepare the command 
   ObjectCounterCommand command = new ObjectCounterCommand(); 
   command.ObjectCounter += new EventHandler<ObjectCounterCommandEventArgs>(ObjectCounterEvent_S2); 
   command.Run(image); 
 
} 
 
private void ObjectCounterEvent_S2(object sender, ObjectCounterCommandEventArgs e) 
{ 
   Debug.WriteLine($"Object Data: Height={e.ObjectRectangle.Height} Width={e.ObjectRectangle.Width} Location: {e.ObjectRectangle.Location.X},{e.ObjectRectangle.Location.Y} "); 
   ObjectCounterCommandEventArgs ee = new ObjectCounterCommandEventArgs(e.ObjectRectangle, e.ObjectData); 
} 
 
static class LEAD_VARS 
{ 
   public const string ImagesDir = @"C:\LEADTOOLS22\Resources\Images"; 
} 
Requirements

Target Platforms

Help Version 22.0.2023.3.31
Products | Support | Contact Us | Intellectual Property Notices
© 1991-2023 LEAD Technologies, Inc. All Rights Reserved.

Leadtools.ImageProcessing.Core Assembly

Products | Support | Contact Us | Intellectual Property Notices
© 1991-2023 LEAD Technologies, Inc. All Rights Reserved.