DoubangoTelecom / ultimateMRZ-SDK

Machine-readable zone/travel document (MRZ / MRTD) detector and recognizer using deep learning
https://www.doubango.org/webapps/mrz/
Other
174 stars 49 forks source link

Static UltMrzSdkResult #61

Closed nedevskig closed 2 years ago

nedevskig commented 2 years ago

Hi. We are using the MRZ Reader (c# API) in a Windows Service. Is it ok to use a static instance of UltMrzSdkResult like this: private static UltMrzSdkResult mrzResult;

private string ProcessImage(Bitmap image) { ... // Initialize the engine: Load deep learning models and init GPU shaders // This function should be called once. // https://www.doubango.org/SDKs/mrz/docs/cpp-api.html#_CPPv4N14ultimateMrzSdk15UltMrzSdkEngine4initEPKc if(mrzResult == null) { mrzResult = CheckMRZResult("Init", UltMrzSdkEngine.init(...)); } ... }

DoubangoTelecom commented 2 years ago

Yes ... but why?

nedevskig commented 2 years ago

So there is no performance or any other issues if we initialize the engine on every call ? Should we then de-initialize on every call?

DoubangoTelecom commented 2 years ago

So there is no performance or any other issues if we initialize the engine on every call ? Should we then de-initialize on every call?

This is not what I understood from the initial message. There is a huge performance issue if you init/deinit for each call