Detecting Characters

////////////////////////////////////////////////////////
// This code snippet shows how to detect characters   //
// in an image, using a few parameters and a topology //
////////////////////////////////////////////////////////
// Load an Image
EImageBW8 image;
image.Load("image.tif");
// Attach a ROI to the image
EROIBW8 roi;
roi.Attach(&image, 50, 224, 340, 96);
// Create an EOCR2 instance
EOCR2 ocr2;
// Set the expected character sizes
ocr2.SetCharsWidthRange(EIntegerRange(25,25));
ocr2.SetCharsHeight(37);
// Set the text polarity, in this case WhiteOnBlack
ocr2.SetTextPolarity(EasyOCR2TextPolarity_WhiteOnBlack);
// Set the topology
ocr2.SetTopology(".{10}\n.{3} .{4}");
// Detect the text in the image. The output Text structure contains:
// - an individual textbox for each character
// - an individual bitmap image for each character
// - a threshold value to binarize the bitmap image for each character
// All structured in a hierarchy with Lines –> Words -> Characters
EOCR2Text text = ocr2.Detect(roi);
////////////////////////////////////////////////////////
// This code snippet shows how to detect characters   //
// in an image, using a few parameters and a topology //
////////////////////////////////////////////////////////
// Load an Image
EImageBW8 image = new EImageBW8();
image.Load("image.tif");
// Attach a ROI to the image
EROIBW8 roi = new EROIBW8();
roi.Attach(image, 50, 224, 340, 96);
// Create an EOCR2 instance
EOCR2 ocr2 = new EOCR2();
// Set the expected character sizes
ocr2.CharsWidthRange = new EIntegerRange(25,25);
ocr2.CharsHeight = 37;
// Set the text polarity, in this case WhiteOnBlack
ocr2.TextPolarity = EasyOCR2TextPolarity.WhiteOnBlack;
// Set the topology
ocr2.Topology = ".{10}\n.{3} .{4}";
// Detect the text in the image. The output Text structure contains:
// - an individual textbox for each character
// - an individual bitmap image for each character
// - a threshold value to binarize the bitmap image for each character
// All structured in a hierarchy with Lines –> Words -> Characters
EOCR2Text text = ocr2.Detect(roi);
// Cleanup
text.Dispose();
ocr2.CharsWidthRange.Dispose();
ocr2.Dispose();
roi.Dispose();
image.Dispose();

The image used in this code snippet