Welcome Guest! To enable all features, please Login or Register.

Notification

Icon
Error

Options
View
Last Go to last post Unread Go to first unread post
#1 Posted : Monday, April 17, 2017 10:29:12 AM(UTC)

Roberto  
Roberto

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 DPI
Typically the recommended DPI is 200-300 for best results.
You can handle this on Load specifying load options for the RasterCodecs class. RasterizeDocument and Load
Code:
//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 images
Especially 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/sdk/dh/po/deskewcommand.html
You can see this command in action here: https://www.leadtools.com/help/sdk/image-processing-functions/deskew.html
Code:
DeskewCommand deskew = new DeskewCommand();
deskew.Run(image);
In this example image being the RasterImage instance that contains your input.

Black and White for best results
You 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/sdk/dh/po/autobinarizecommand.html
Code:
AutoBinarizeCommand autoBinarize = new AutoBinarizeCommand();
autoBinarize.Run(image);
You can also use DynamicBinaryCommand to achieve this with more control:
https://www.leadtools.com/help/sdk/dh/pc/dynamicbinarycommand.html

Noise Reduction
LEADTOOLS 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/sdk/dh/po/minimumcommand.html
MedianCommand, changes the pixel color to that of the median value of the pixel in its neighborhood: https://www.leadtools.com/help/sdk/dh/po/mediancommand.html
MaximunCommand, erodes dark objects in the image: https://www.leadtools.com/help/sdk/dh/po/maximumcommand.html
DespekleCommand, removes speckles/noise from the image. Great for scanned and faxed files. https://www.leadtools.com/help/sdk/dh/po/despecklecommand.html

Edited by moderator Wednesday, December 27, 2023 3:31:24 PM(UTC)  | Reason: Updated

Roberto Rodriguez
Developer Support Engineer
LEAD Technologies, Inc.

LEAD Logo
 

Try the latest version of LEADTOOLS for free for 60 days by downloading the evaluation: https://www.leadtools.com/downloads

Wanna join the discussion? Login to your LEADTOOLS Support accountor Register a new forum account.

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.

Powered by YAF.NET | YAF.NET © 2003-2024, Yet Another Forum.NET
This page was generated in 0.055 seconds.