KeyMarkRecognizerCommand Class
In This Topic
Searches the corner marks on an image.
Object Model
Syntax
Remarks
Corner mark is a search pattern ("L" pattern), which consists of two lines, of equal length, outgoing from one point at a right angle.
Example
This C#/VB.NET code shows how to identify a document image using algorithm that creates an image footprint based on L search patterns.
''' <summary>
''' Identifies the image using key marks.
''' </summary>
''' <param name="templateImages">The template images.</param>
''' <param name="testImage">The test image.</param>
''' <returns>Result of template matching.</returns>
Public Shared Function IdentifyUsingMarks(templateImages As Vintasoft.Imaging.VintasoftImage(), testImage As Vintasoft.Imaging.VintasoftImage) As Vintasoft.Imaging.FormsProcessing.TemplateMatching.TemplateMatchingResult
' create a recognizer
Dim markRecognizerCommand As New Vintasoft.Imaging.FormsProcessing.TemplateMatching.KeyMarkRecognizerCommand()
' set units of measure
markRecognizerCommand.UnitOfMeasure = Vintasoft.Imaging.UnitOfMeasure.Pixels
' set max size of mark
markRecognizerCommand.MaxMarkSize = 300
' set min size of mark
markRecognizerCommand.MinMarkSize = 50
' create a template matching command
Dim templateMatchingCommand As New Vintasoft.Imaging.FormsProcessing.TemplateMatching.TemplateMatchingCommand()
' set imprint generator based on recognizer
templateMatchingCommand.ImageImprintGenerator = New Vintasoft.Imaging.FormsProcessing.TemplateMatching.ImageImprintGeneratorCommand(markRecognizerCommand)
' add template images
templateMatchingCommand.TemplateImages.AddRange(templateImages)
' execute template matching
templateMatchingCommand.ExecuteInPlace(testImage)
' return result
Return templateMatchingCommand.Result
End Function
/// <summary>
/// Identifies the image using key marks.
/// </summary>
/// <param name="templateImages">The template images.</param>
/// <param name="testImage">The test image.</param>
/// <returns>Result of template matching.</returns>
public static Vintasoft.Imaging.FormsProcessing.TemplateMatching.TemplateMatchingResult IdentifyUsingMarks(
Vintasoft.Imaging.VintasoftImage[] templateImages,
Vintasoft.Imaging.VintasoftImage testImage)
{
// create a recognizer
Vintasoft.Imaging.FormsProcessing.TemplateMatching.KeyMarkRecognizerCommand markRecognizerCommand =
new Vintasoft.Imaging.FormsProcessing.TemplateMatching.KeyMarkRecognizerCommand();
// set units of measure
markRecognizerCommand.UnitOfMeasure = Vintasoft.Imaging.UnitOfMeasure.Pixels;
// set max size of mark
markRecognizerCommand.MaxMarkSize = 300;
// set min size of mark
markRecognizerCommand.MinMarkSize = 50;
// create a template matching command
Vintasoft.Imaging.FormsProcessing.TemplateMatching.TemplateMatchingCommand templateMatchingCommand =
new Vintasoft.Imaging.FormsProcessing.TemplateMatching.TemplateMatchingCommand();
// set imprint generator based on recognizer
templateMatchingCommand.ImageImprintGenerator =
new Vintasoft.Imaging.FormsProcessing.TemplateMatching.ImageImprintGeneratorCommand(markRecognizerCommand);
// add template images
templateMatchingCommand.TemplateImages.AddRange(templateImages);
// execute template matching
templateMatchingCommand.ExecuteInPlace(testImage);
// return result
return templateMatchingCommand.Result;
}
Inheritance Hierarchy
Requirements
Target Platforms: .NET9; .NET 8; .NET 7; .NET 6; .NET Framework 4.8, 4.7, 4.6, 4.5, 4.0, 3.5
See Also