Smart and powerful OCR tools

Nicomsoft OCR SDK – FAQ


- I need to recognize Arabic, Hebrew, Sanskrit, Chinese...

We are sorry, these languages are not supported and currently we don't have any plans to support them because these languages have completely different character set. Please refer to this page for the complete list of supported languages.

- Is it your own OCR system or some third-party OCR is used?

While most providers of OCR systems use third-party OCR engines with royalty licensing policy, we have own OCR engine, we own all the intellectual property of our technologies and we don’t need to pay licenses to anyone. That is why our solutions are commercially competitive and we offer our OCR engine at royalty-free basis.

- What programming languages are supported?

Our OCR engine can be used in all programming languages that can use DLL or COM. Download evaluation version of OCR SDK and check sample projects that can be used as start point to integrate OCR technology with your software. OCR SDK contains sample projects for C# WinForms, C# WPF, ASP.NET, VB.NET, VB, C++, Delphi, C++ Builder.

- How do I integrate NSOCR into my software?

You need to include "Bin" folder of NSOCR SDK to your software. Also "Bin_64" folder is necessary if your application is x64. If NSOCR is used as COM object you also need to register nsocr.dll with "Regsvr32" tool during your software installation. Refer to "Redistribution of Nicomsoft OCR files" section of developer manual for details. Link to online version of this section.

- Does licensed version recognize images better than trial version?

No, trial version has same set features as licensed version, recognition quality is the same. Full list of limitations of trial version you can find here.

- How to use OCR via CREATEOBJECT(ProgID)?

In some programming languages you can use OCR as COM object via CreateObject function that creates COM object by its ProgID. ProgID for NSOCR COM object is "NSOCRLib.NSOCR.1".

- I rescaled image before passing it to OCR, but recognition is not good. Why?

By default, NSOCR automatically detects image resolution and rescales it for the best results. If you need to disable auto rescaling do not rescale image manually in your application. Instead, adjust "ImgAlizer/ScaleFactor" option and set "ImgAlizer/AutoScale"="0", you will get better results because NSOCR uses own smart resampling algorithm, also this way it will know original resolution and will adjust recognition algorithms for get better recognition quality.

- I want to recognize images using several threads, is it possible?

By default, NSOCR detects the number of CPU cores and use them all during OCR, even if only one image is processed. You can change it with "Main/NumKernels" option. However, not all OCR algorithms can be parallelized and CPU will not be utilized completely. If you have many images and need to process them as fast as possible, the best way is to process several images at once and use one thread for every image. Refer to "General description of Nicomsoft OCR SDK architecture" article for details, also check "C# Multithreading Sample" project from OCR SDK.

- I need to recognize only a part of image, how to do it?

It is necessary to define one or more blocks with "Img_AddBlock" function before recognition, this way NSOCR will not detect text areas automatically and will recognize only specified image areas. Refer to sample projects for details, the code will look like this:

NsOCR.Img_AddBlock(...); //specify area for OCR

- I get ERROR_NOMEMORY or ERROR_TOOMANYOBJECTS error after several images.

It means that you do not release NSOCR objects (CFG, OCR, IMG, BLK) but only create them again and again in loop. Do not forget to release objects. Refer to "Typical mistakes" section of  this article for details.

- Is it possible to speed up the recognition?

Yes, it is possible to improve the speed in several times in many cases. Refer to OCR SDK documentation, "Performance Tips" section. Link to online version of this section.

- I use VS2010 in Windows x64 and my .NET application cannot use NSOCR COM object.

OCR SDK has both x86 and x64 binaries and built-in sample projects work properly in any recent version of Windows x86/x64 and Visual Studio. However, VS2010 has a bug that cause "BadImageFormatException" exception for "Interop.NSOCRLib" if you use Windows x64 and your .NET project has "Any CPU" target with default settings. Related links:
The most easy solution is to change "AnyCPU" target to "x86". The second way is to add "<PlatformTarget>AnyCPU</PlatformTarget>" option directly to project file, we did it for .NET samples of NSOCR SDK. For NET4.0 projects you can also set "Embed Interop Types" option to "true" to avoid using interop library at all.

- An image has different contrast levels and binarization is not good for some blocks.

You can set option "Binarizer/BinTwice" to "1" and NSOCR will binarize every defined block individually again at OCRSTEP_OCR step.

- Is rotated or inverted text supported?

Yes. Entire image or some block(s) can be inverted, rotated or mirrored. Check "Blk_Inversion", "Blk_Rotation" and "Blk_Mirror" in developer manual, also refer to any "Advanced Sample" project for details.

- I changed Config.dat manually and now Cfg_LoadOptions function returns error code.

It means that Config.dat is spoiled, reinstall OCR SDK to restore it. Config.dat is unicode XML file, so make sure you edit it correctly. For instance, if you want to adjust "Main/DisabledChars" option to exclude "&" character from recognition you must specify this character as "&amp;". For such situations you can use "Cfg_LoadOptions" + "Cfg_SetOption" + "Cfg_SaveOptions" functions to edit Config.dat, they will perform all necessary conversions.

- Can I use OCR in C# directly, not via COM?

Yes, check "C# Invoke Sample" project.

- Can I get position of recognized words and characters?

Yes, use "Blk_GetTextRect" and "Blk_GetCharRect" functions.

- I need to recognize handwritten text

Our OCR SDK does not support recognition of handwritten text or fonts that look like handwritten text.

- I need to recognize digits only

Set "Main/EnabledChars" option to "0123456789"; edit "Config.dat" file manually or use "Cfg_SetOption" function:

NsOCR.Cfg_SetOption(CfgObj, TNSOCR.BT_DEFAULT, "Main/EnabledChars", "0123456789");

Or use "Blk_SetType" function and set BT_OCRDIGIT block type.

- I cannot scan via TWAIN in Windows x64

Unfortunately, most of scanner manufacturers do not have x64 TWAIN drivers for their scanners and therefore you cannot use TWAIN in Windows x64. Our OCR also supports WIA interface that can be used in both Windows x86 and x64.

- I use Img_LoadBmpData or Img_LoadFromMemory but cannot make it work.

  The most probably reason is that you use incorrect function for the image data you have. In memory you can either have data in some image file format, or you can have raw bitmap data. If you save the data to a file and this file can be opened as image file by any image viewer application it means that you should use Img_LoadFromMemory function; this function works exactly as Img_LoadFromFile but loads image from memory, such image can be BMP, JPEG, TIFF etc.
If you have raw bitmap data in memory without any headers or compression - use Img_LoadBmpData function, this function expects raw bitmap data, for example, 24-bit RGB values. If you load an image from file to some .NET image object, save it to some stream and then try to load via Img_LoadBmpData, it will not work, use Img_LoadFromMemory function instead since you have data in some image format, not raw RGB bitmap data.
Sample projects from OCR SDK have code that demonstrates usage of both these functions.

- How can I find all barcodes on an image?

Set "Zoning/FindBarcodes" to "2", load image and recognize it. Sample code (C#):

//assume reference to NSOCR COM was added
using NSOCR_NameSpace; //Add NSOCR namespace from "NSOCR.cs" file
int CfgObj, OcrObj, ImgObj;
string txt;
NSOCRLib.NSOCRClass NsOCR = new NSOCRLib.NSOCRClass(); //create NSOCR COM object instance
NsOCR.Engine_InitializeAdvanced(out CfgObj, out OcrObj, out ImgObj); //initialize OCR engine, create objects and load configuration
NsOCR.Img_LoadFile(ImgObj, "c:\\sample.bmp"); //load some image for OCR
Cfg_SetOption(CfgObj, TNSOCR.BT_DEFAULT, "Zoning/FindBarcodes", "2"); //find barcodes only
NsOCR.Img_GetImgText(ImgObj, out txt, TNSOCR.FMT_EXACTCOPY); //get text
NsOCR.Engine_Uninitialize(); //release all created objects and uninitialize OCR engine

If you need to recognize only barcodes it is a good idea to disable such algorithms as autoscaling, deskew, garbage and lines removing to improve recognition quality and performance.

- I cannot process PDF files in my .NET application in Windows x64.

If sample applications from OCR SDK work properly but your application fails it means that you need to install x64 version of GhostScript. .NET samples from OCR SDK are compiled to always be x86 applications ("x86" target platform is selected) but probably your application has default "AnyCPU" target platform, so it is x64 application in Windows x64 and therefore it uses x64 binaries of OCR SDK and requires x64 version of GhostScript. Either install x64 version of GhostScript, or select "x86" target platform for your application instead of "AnyCPU".

- Do you have the list of compatible scanners?

OCR can use standard TWAIN and WIA interfaces for scanning, so in theory it must work with all scanners that have TWAIN or WIA drivers. However, sometimes scanner manufacturers offer buggy drivers and such scanners cannot be used or they can be used with some limitations. This problem is related to scanner models and driver versions individually, therefore we don't have the list of compatible scanners, we cannot test all scanners that are available on the market.

- Functions Blk_GetTextRect and Blk_GetCharRect return incorrect coordinates!

For the best recognition, rescaling and deskew algorithms are applied to original image at OCRSTEP_PREFILTERS step, these functions return coordinates on final image. To get coordinates on original image use "Img_CalcPointPosition" function to convert coordinates.

- I cannot call some OCR function from VBScript or JavaScript

Probably this function uses some parameter(s) by reference, in other words it returns some values via variables that you pass. VBScript or JavaScript cannot call such functions, you should use "Engine_CallFunction" function to call such function. Refer to developer's manual for more details about this function and check VBScript and JScript samples from OCR SDK.

- During PDF-to-PDF conversion, output PDF file is much larger than input PDF file!

Probably input PDF file contains black-white images and "Saver/PDF/ImageLayer" option is "1" so output PDF has a lot of large images. Set "Main/GrayMode" option to "2" to enable black-white mode, NSOCR will save images as black-white, output PDF file will become much smaller.

- I need to get text of some block separately.

Use "Blk_GetText" function. Sample code (C#):

//assume reference to NSOCR COM was added
using NSOCR_NameSpace; //Add NSOCR namespace from "NSOCR.cs" file
int CfgObj, OcrObj, ImgObj, BlkObj, i, BlockCnt;
string txt;
NSOCRLib.NSOCRClass NsOCR = new NSOCRLib.NSOCRClass(); //create NSOCR COM object instance
NsOCR.Engine_InitializeAdvanced(out CfgObj, out OcrObj, out ImgObj); //initialize OCR engine, create objects and load configuration
NsOCR.Img_LoadFile(ImgObj, "c:\\sample.bmp"); //load some image for OCR
BlockCnt = NsOCR.Img_GetBlockCnt(ImgObj);
for (i = 0; i < BlockCnt; i++)
NsOCR.Img_GetBlock(ImgObj, i, out BlkObj);
NsOCR.Blk_GetText(BlkObj, out txt, TNSOCR.FMT_EXACTCOPY); //get block text
//do something with block text "txt"
NsOCR.Engine_Uninitialize(); //release all created objects and uninitialize OCR engine