10 August 2016
- Last edited 10 August 2016
Please find more detailed answers below:
When you open an image in FineReader Engine 11 (for example, using the IFRDocument::AddImageFile method), the image is converted into the so-called “internal format”. The open image file is represented by an object of the ImageDocument type, and this object contains a number of image planes, represented by a respective number of the Image objects. These planes are: full-size black-and-white (a binarized image), gray and color copies of the deskewed image and a small color preview. To see the binarized copy of image you should save it to the file, for example you can do it in C# via the IFRPage::ImageDocument::BlackWhiteImage::WriteToFile() method.
Please read more in the Developer’s Help file -> Guided Tour -> Working with Images.
• Image despeckling
Sometimes source images may be very noisy with lots of dots or speckles on them. These speckles, when they appear close to the letters or numbers, may affect the quality of OCR. The size of the speckles to be removed may be specified by the user. For example, you can use the IImageDocument::RemoveGarbage method and specify the maximum area of black dots that are to be considered garbage in pixels as the second GarbageSize parameter.
// Add image file to document
document.AddImageFile( imagePath, null, null );
int pagesCount = document.Pages.Count;
for (int i = 0; i < pagesCount; i++)
FREngine.FRPage page = document.Pages.Item(i);
page.ImageDocument.RemoveGarbage( null, 3 );
page.ImageDocument.BlackWhiteImage.WriteToFile(Path.Combine(FreConfig.GetSamplesFolder(), @"SampleImages\DespeckledImage.png"), FREngine.ImageFileFormatEnum.IFF_PngBwPng, null, null);
• Image deskewing
When you use auto-deskewing, you can choose from several modes for deskewing images: with pairs of black squares, lines or lines of text. Please see all possible values for the IPrepareImageMode::CorrectSkewMode property in the Developer's Help file.
// Correct skew during loading
FREngine.PrepareImageMode pim = engineLoader.Engine.CreatePrepareImageMode();
pim.CorrectSkew = true;
pim.CorrectSkewMode = (int)(FREngine.CorrectSkewModeEnum.CSM_CorrectSkewByHorizontalText |
document.AddImageFile( imagePath, pim, null );