VintaSoft Imaging .NET SDK and Plug-ins Discussions
Questions, comments and suggestions concerning VintaSoft Imaging .NET SDK.
Board index < VintaSoft Imaging < VintaSoft Imaging .NET SDK and Plug-ins Discussions
private static ImageImprintGeneratorCommand CreateImageImprintGenerator(string imprintGeneratorType)
{
// select image imprint generator type
switch (imprintGeneratorType)
{
case "Line":
case "":
return new ImageImprintGeneratorCommand(new KeyLineRecognizerCommand());
case "Lpattern":
return new ImageImprintGeneratorCommand(new KeyMarkRecognizerCommand());
case "All":
KeyZoneRecognizerCommand[] command = new KeyZoneRecognizerCommand[] { new KeyLineRecognizerCommand(), new KeyMarkRecognizerCommand() };
return new ImageImprintGeneratorCommand(command);
default:
Console.WriteLine("Unknown imprint generator type. Using default type: Line.");
return new ImageImprintGeneratorCommand(new KeyLineRecognizerCommand());
}
}
For preprocessing of source image before key zone recognition you need to modify code of CreateImageImprintGenerator method to the following code:
private static ImageImprintGeneratorCommand CreateImageImprintGenerator(string imprintGeneratorType)
{
// select image imprint generator type
switch (imprintGeneratorType)
{
case "Line":
case "":
KeyLineRecognizerCommand keyLineRecognizerCommand = new KeyLineRecognizerCommand();
keyLineRecognizerCommand.ImagePreprocessing = new DilateCommand();
return new ImageImprintGeneratorCommand(keyLineRecognizerCommand);
case "Lpattern":
return new ImageImprintGeneratorCommand(new KeyMarkRecognizerCommand());
case "All":
KeyZoneRecognizerCommand[] command = new KeyZoneRecognizerCommand[] { new KeyLineRecognizerCommand(), new KeyMarkRecognizerCommand() };
return new ImageImprintGeneratorCommand(command);
default:
Console.WriteLine("Unknown imprint generator type. Using default type: Line.");
return new ImageImprintGeneratorCommand(new KeyLineRecognizerCommand());
}
}
Best regards, Alexander
that helpt and the Dilate Command is running as expected. Thanks for that. But: how to add a second/third preprocess command, such as despeckle or the whole ocrpreprocess command. I couldn't find an 'Add-method' for the 'keyLineRecognizerCommand.ImagePreprocessing', only new.Sorry for delay. If you need fast response to your question, please send your question to our support at support@vintasoft.com.
private static ImageImprintGeneratorCommand CreateImageImprintGenerator(string imprintGeneratorType)
{
// select image imprint generator type
switch (imprintGeneratorType)
{
case "Line":
case "":
Vintasoft.Imaging.ImageProcessing.ProcessingCommandBase[] commands =
new Vintasoft.Imaging.ImageProcessing.ProcessingCommandBase[] {
new Vintasoft.Imaging.ImageProcessing.Filters.DilateCommand(),
new Vintasoft.Imaging.ImageProcessing.Document.DespeckleCommand()
};
KeyLineRecognizerCommand keyLineRecognizerCommand = new KeyLineRecognizerCommand();
keyLineRecognizerCommand.ImagePreprocessing = new Vintasoft.Imaging.ImageProcessing.CompositeCommand(commands);
return new ImageImprintGeneratorCommand(keyLineRecognizerCommand);
case "Lpattern":
return new ImageImprintGeneratorCommand(new KeyMarkRecognizerCommand());
case "All":
KeyZoneRecognizerCommand[] command = new KeyZoneRecognizerCommand[] { new KeyLineRecognizerCommand(), new KeyMarkRecognizerCommand() };
return new ImageImprintGeneratorCommand(command);
default:
Console.WriteLine("Unknown imprint generator type. Using default type: Line.");
return new ImageImprintGeneratorCommand(new KeyLineRecognizerCommand());
}
}
Best regards, Alexander