Minimum length of the horizontal line, relative to the image width that can be detected.
public int HorizontalLineMinimumLength {get; set;}
public:
property Int32 HorizontalLineMinimumLength
{
Int32 get()
void set(Int32 value)
}
HorizontalLineMinimumLength # get and set (FindCandidateFormFieldsCommand)
Valid values for this parameter range from 1 to 100. The FindCandidateFormFieldsCommand returns the ERROR_INV_PARAMETER error code if the value is < 1 or > 100.
Minimum length of the horizontal line, relative to the image width that can be detected.
using Leadtools;
using Leadtools.Codecs;
using Leadtools.ImageProcessing.Core;
public void FindCandidateFormFieldsCommandExample()
{
RasterCodecs codecs = new RasterCodecs();
RasterImage image = codecs.Load(Path.Combine(LEAD_VARS.ImagesDir, @"Forms\Forms to be Recognized\OMR\AnswerSheet_Pattern.jpg"), 0, Leadtools.Codecs.CodecsLoadByteOrder.Bgr, 1, 1);
FindCandidateFormFieldsCommand findFields = new FindCandidateFormFieldsCommand();
findFields.HorizontalLineMinimumLength = 10;
findFields.VerticalLineMinimumLength = 3;
findFields.Run(image);
TextField[] textFields = findFields.TextFieldAreas;
OMRField[] omrFields = findFields.OMRFieldAreas;
foreach (TextField field in textFields)
{
TextFieldType textFieldType = field.FieldType;
StringBuilder stringBuilder = new StringBuilder("** Text Field Properties **\n");
stringBuilder.AppendLine("Filled: " + field.IsFilled.ToString());
stringBuilder.AppendLine("Empty space, if there is any on the top or the bottom of the filled area: " + field.SpaceBounds[0].ToString());
stringBuilder.AppendLine("Empty space, if there is any on the right side of the filled area: " + field.SpaceBounds[1].ToString());
stringBuilder.AppendLine("TextFieldType: " + textFieldType.ToString());
stringBuilder.AppendLine("Bounds: " + field.Bounds.ToString());
stringBuilder.AppendLine("FilledAreaBounds: " + field.FilledAreaBounds.ToString());
System.Diagnostics.Debug.WriteLine(stringBuilder.ToString());
// Function TODO : Drawing rectangle field.Bounds
// Function TODO : Drawing rectangle field.FilledAreaBounds
}
foreach (OMRField field in omrFields)
{
if (field.FieldType == OMRFieldType.BoxOMR)
{
// Function TODO : Drawing rectangle field.UnFilledBound
}
else
{
// Function TODO : Drawing circle field.UnFilledBound
}
StringBuilder stringBuilder = new StringBuilder("** OMR Field Properties **\n");
stringBuilder.AppendLine("FilledBound: " + field.FilledBound.ToString());
stringBuilder.AppendLine("FilledConfidence: " + field.FilledConfidence.ToString());
stringBuilder.AppendLine("IsFilled: " + field.IsFilled.ToString());
stringBuilder.AppendLine("OMRConfidence: " + field.OMRConfidence.ToString());
stringBuilder.AppendLine("UnfilledBound: " + field.UnfilledBound.ToString());
System.Diagnostics.Debug.WriteLine(stringBuilder.ToString());
}
image.Dispose();
codecs.Dispose();
}
static class LEAD_VARS
{
public const string ImagesDir = @"C:\LEADTOOLS23\Resources\Images";
}
import static org.junit.Assert.assertTrue;
import java.io.File;
import java.io.IOException;
import org.junit.*;
import org.junit.runner.JUnitCore;
import org.junit.runner.Result;
import org.junit.runner.notification.Failure;
import leadtools.*;
import leadtools.codecs.*;
import leadtools.imageprocessing.core.*;
public void findCandidateFormFieldsCommandExample() {
final String LEAD_VARS_IMAGES_DIR = "C:\\LEADTOOLS23\\Resources\\Images";
RasterCodecs codecs = new RasterCodecs();
RasterImage image = codecs.load(
combine(LEAD_VARS_IMAGES_DIR, "Forms\\Forms to be Recognized\\OMR\\AnswerSheet_Pattern.jpg"), 0,
CodecsLoadByteOrder.BGR, 1, 1);
FindCandidateFormFieldsCommand findFields = new FindCandidateFormFieldsCommand();
findFields.setHorizontalLineMinimumLength((char) 10);
findFields.setVerticalLineMinimumLength((char) 3);
int flags = findFields.run(image);
assertTrue(flags != 0);
TextField[] textFields = findFields.getTextFieldAreas();
OMRField[] omrFields = findFields.getOMRFieldAreas();
for (TextField field : textFields) {
TextFieldType textFieldType = field.getFieldType();
StringBuilder sBuilder = new StringBuilder();
sBuilder.append("** Text Field Properties **");
sBuilder.append("\nFilled: " + field.isFilled());
sBuilder.append("\nEmpty space, if there is any on the top or the bottom of the filled area: "
+ field.getSpaceBounds()[0].toString());
sBuilder.append("\nEmpty space, if there is any on the right side of the filled area: "
+ field.getSpaceBounds()[1].toString());
sBuilder.append("\nTextFieldType: " + textFieldType.toString());
sBuilder.append("\nBounds: " + field.getBounds().toString());
sBuilder.append("\nFilledAreaBound: " + field.getFilledAreaBounds().toString());
System.out.println(sBuilder.toString() + "\n");
}
for (OMRField field : omrFields) {
if (field.getFieldType() == OMRFieldType.BOX_OMR) {
// Function TODO : Drawing rectangle field.UnFilledBound
}
{
// Function TODO : Drawing circle field.UnFilledBound
}
StringBuilder sBuilder = new StringBuilder();
sBuilder.append("** OMR Field Properties **");
sBuilder.append("\nFilledBound: " + field.getFilledBound().toString());
sBuilder.append("\nFilledConfidence: " + field.getFilledConfidence());
sBuilder.append("\nIsFilled: " + field.isFilled());
sBuilder.append("\nOMRConfidence: " + field.getOMRConfidence());
sBuilder.append("\nUnfilledBound: " + field.getUnfilledBound().toString());
System.out.println(sBuilder.toString());
}
image.dispose();
codecs.dispose();
}
FindCandidateFormFieldsCommand Class
FindCandidateFormFieldsCommand Members
Leadtools.ImageProcessing.Core Namespace
Help Collections
Raster .NET | C API | C++ Class Library | HTML5 JavaScript
Document .NET | C API | C++ Class Library | HTML5 JavaScript
Medical .NET | C API | C++ Class Library | HTML5 JavaScript
Medical Web Viewer .NET
Multimedia
Direct Show .NET | C API | Filters
Media Foundation .NET | C API | Transforms
Supported Platforms
.NET, Java, Android, and iOS/macOS Assemblies
Imaging, Medical, and Document
C API/C++ Class Libraries
Imaging, Medical, and Document
HTML5 JavaScript Libraries
Imaging, Medical, and Document
Your email has been sent to support! Someone should be in touch! If your matter is urgent please come back into chat.
Chat Hours:
Monday - Friday, 8:30am to 6pm ET
Thank you for your feedback!
Please fill out the form again to start a new chat.
All agents are currently offline.
Chat Hours:
Monday - Friday
8:30AM - 6PM EST
To contact us please fill out this form and we will contact you via email.