|OcrApiInit Method (Languages, String, OcrEngineMode, String, String, String, Boolean)|
public void Init( Languages language, string dataPath = null, OcrEngineMode oem = OcrEngineMode.OEM_DEFAULT, string configs = null, string varsVec = null, string varsValues = null, bool setOnlyNonDebugParams = false )
Public Sub Init ( language As Languages(), Optional dataPath As String = Nothing, Optional oem As OcrEngineMode = OcrEngineMode.OEM_DEFAULT, Optional configs As String() = Nothing, Optional varsVec As String() = Nothing, Optional varsValues As String() = Nothing, Optional setOnlyNonDebugParams As Boolean = false )
public: void Init( array<Languages>^ language, String^ dataPath = nullptr, OcrEngineMode oem = OcrEngineMode::OEM_DEFAULT, array<String^>^ configs = nullptr, array<String^>^ varsVec = nullptr, array<String^>^ varsValues = nullptr, bool setOnlyNonDebugParams = false )
member Init : language : Languages * ?dataPath : string * ?oem : OcrEngineMode * ?configs : string * ?varsVec : string * ?varsValues : string * ?setOnlyNonDebugParams : bool (* Defaults: let _dataPath = defaultArg dataPath null let _oem = defaultArg oem OcrEngineMode.OEM_DEFAULT let _configs = defaultArg configs null let _varsVec = defaultArg varsVec null let _varsValues = defaultArg varsValues null let _setOnlyNonDebugParams = defaultArg setOnlyNonDebugParams false *) -> unit
public void Init( Languages language, String dataPath = null, OcrEngineMode oem = OcrEngineMode.OEM_DEFAULT, String configs = null, String varsVec = null, String varsValues = null, boolean setOnlyNonDebugParams = false )
function Init(language, dataPath, oem, configs, varsVec, varsValues, setOnlyNonDebugParams);
|Instances are mostly thread-safe and totally independent, but some global parameters remain. Basically it is safe to use multiple OcrApis in different threads in parallel, UNLESS: you use SetVariable(String, String, Boolean) on some of the Params in classify and textord. If you do, then the effect will be to change it for all your instances.|
For full list of tesseract variables see this article: Tesseract.Net parametersThat the only members that may be called before Init are those listed below:
It is entirely safe (and eventually will be efficient too) to call Init multiple times on the same instance to change language, or just to reset the classifier.
The language may be a string of the form [~]lang[+[~]lang]* indicating that multiple languages are to be loaded.Eg hin+eng will load Hindi and English.Languages may specify internally that they want to be loaded with one or more other languages, so the ~sign is available to override that.Eg if hin were set to load eng by default, then hin+~eng would force loading only hin.The number of loaded languages is limited only by memory, with the caveat that loading additional languages will impact both speed and accuracy, as there is more work to do to decide on the applicable language, and there is more chance of hallucinating incorrect words.
|WARNING: On changing languages, all Tesseract parameters are reset back to their default values. (Which may vary between languages.) If you have a rare need to set a Variable that controls initialization for a second call to Init you should explicitly call Release and then use SetVariable before Init.This is only a very rare use case, since there are very few uses that require any parameters to be set before Init.|