Table of Contents

Class CVTemplateMatchEventArgs

Namespace
VisioForge.Core.Types.Events
Assembly
VisioForge.Core.dll

Provides data for events that indicate the result of a template matching operation. This class encapsulates the bounding rectangle of the matched area and a confidence score.

public class CVTemplateMatchEventArgs : EventArgs

Inheritance

Inherited Members

Remarks

Template matching is a technique for finding small parts of an image (templates) within a larger image. This event argument is typically used in computer vision applications for object recognition, tracking, or quality control. The Rectangle property defines the location and size of the best matching region in the source image. The Result property provides a confidence score indicating match quality, with interpretation depending on the matching method. Common matching methods include squared difference, correlation coefficient, and normalized cross-correlation. Higher correlation values (closer to 1.0) typically indicate better matches, while lower squared difference values indicate better matches. Template matching is sensitive to scale, rotation, and lighting variations - templates must closely match target appearance. Applications include logo detection, UI automation, defect detection in manufacturing, and pattern recognition. Multi-scale template matching can improve robustness to size variations by testing templates at different scales. For rotation-invariant matching, consider using feature-based methods instead of template matching. Performance can be optimized by limiting search regions or using image pyramids for coarse-to-fine matching. False positives can be reduced by setting appropriate confidence thresholds based on the matching method used. Events are raised on background processing threads, requiring thread-safe handling and UI marshaling.

Constructors

CVTemplateMatchEventArgs(Rect, double)

Initializes a new instance of the VisioForge.Core.Types.Events.CVTemplateMatchEventArgs class.

public CVTemplateMatchEventArgs(Rect rectangle, double result)

Parameters

rectangle Rect

The bounding rectangle of the matched area.

result double

The confidence score of the match.

Properties

Rectangle

Gets the VisioForge.Core.Types.Rect representing the bounding box of the area in the source image that best matches the template.

public Rect Rectangle { get; }

Property Value

Rect

Result

Gets the match result, which is a confidence score indicating how well the template matched the area. The interpretation of this value depends on the specific template matching method used (e.g., correlation coefficient).

public double Result { get; }

Property Value

double

Methods

ToString()

Returns a string that represents the current VisioForge.Core.Types.Events.CVTemplateMatchEventArgs instance. The string includes the matched rectangle and the result score.

public override string ToString()

Returns

string

A String that represents this instance.