LEADTOOLS Support
Document
Document SDK FAQ
What are the best ways to get most accurate recognition results?
This topic and its replies were posted before the current version of LEADTOOLS was released and may no longer be applicable.
#1
Posted
:
Monday, April 17, 2017 10:29:12 AM(UTC)
Groups: Registered, Tech Support, Administrators
Posts: 39
Thanks: 2 times
Was thanked: 3 time(s) in 3 post(s)
With any type of recognition you will get out of it what you put it, meaning that the better quality the input the better the results. It is understandable that input quality cannot be assured 100% for example with scanned documents or faxes. To help with this LEADTOOLS offers a variety of clean up and processing commands. The following is a checklist of sorts that I find useful when dealing with low success recognition.
Input DPITypically the recommended DPI is 200-300 for best results.
You can handle this on Load specifying load options for the RasterCodecs class.
RasterizeDocument and
LoadCode://if loading a document format
codecs.Options.RasterizeDocument.Load.XResolution = 300;
codecs.Options.RasterizeDocument.Load.YResolution = 300;
//loading image with no DPI information
codecs.Options.Load.XResolution = 300;
codecs.Options.Load.YResolution = 300;
Most images already have DPI information and in order to change this you will need to do some resizing:
Code:static void ResizeDPI(RasterImage image, int xResolution, int yResolution)
{
if (image.XResolution == xResolution && image.YResolution == yResolution)
return;
double width = (image.Width / image.XResolution) * xResolution;
double height = (image.Height / image.YResolution) * yResolution;
SizeCommand sizeCommand = new SizeCommand((int)width, (int)height, RasterSizeFlags.Bicubic);
sizeCommand.Run(image);
image.XResolution = xResolution;
image.YResolution = yResolution;
}
Fix skewed imagesEspecially when the input is a scanned image the input file may be skewed. To correct this you can run our DeskewCommand:
https://www.leadtools.com/help/leadtools/v20/dh/po/deskewcommand.htmlYou can see this command in action here:
https://www.leadtools.com/sdk/image-processing/functions/function?id=46Code:DeskewCommand deskew = new DeskewCommand();
deskew.Run(image);
In this example image being the RasterImage instance that contains your input.
Black and White for best resultsYou can levaerage our AutoBinarize command to automatically create a black and white image using your input file. Most recognition works best on B/W images.
https://www.leadtools.com/help/leadtools/v20/dh/po/autobinarizecommand.htmlCode:AutoBinarizeCommand autoBinarize = new AutoBinarizeCommand();
autoBinarize.Run(image);
You can also use DynamicBinaryCommand to achieve this with more control:
https://www.leadtools.com/help/leadtools/v20/dh/pc/dynamicbinarycommand.htmlNoise ReductionLEADTOOLS offers a number of commands to deal with noisy images, these commands along with the binarization routines mentioned above will be the most helpful in improving recognition rates. For this you can use the following:
Minimun Command, dialte dark objects in the image:
https://www.leadtools.com/help/leadtools/v20/dh/po/minimumcommand.htmlMedianCommand, changes the pixel color to that of the median value of the pixel in its neighborhood:
https://www.leadtools.com/help/leadtools/v20/dh/po/mediancommand.htmlMaximunCommand, erodes dark objects in the image:
https://www.leadtools.com/help/leadtools/v20/dh/po/maximumcommand.htmlDespekleCommand, removes speckles/noise from the image. Great for scanned and faxed files.
https://www.leadtools.com/help/leadtools/v20/dh/po/despecklecommand.htmlEdited by moderator Wednesday, March 21, 2018 10:06:49 AM(UTC)
| Reason: Updated links to v20
Roberto Rodriguez
Developer Support Engineer
LEAD Technologies, Inc.

LEADTOOLS Support
Document
Document SDK FAQ
What are the best ways to get most accurate recognition results?
You cannot post new topics in this forum.
You cannot reply to topics in this forum.
You cannot delete your posts in this forum.
You cannot edit your posts in this forum.
You cannot create polls in this forum.
You cannot vote in polls in this forum.