Intrada ALPR .NET
To facilitate integration of Intrada ALPR within a .NET environment, we have prepared a managed library that abstracts the Intrada ALPR instructions to the object oriented concepts as used in C# and VB .NET.
To facilitate integration of Intrada ALPR within a .NET environment, we have prepared a managed library that abstracts the bare ALPR instructions to the object oriented concepts as used in C# and VB .NET. This document gives a concise overview of the functionality and usage of the Intrada.NET ALPR library. The use of the library is explained by an overview of available methods and on the basis of a number of C# and VB.NET code fragments.
Summary of intended usage:
- In essence, the Intrada.NET library provides a convenient way to use the intrada.dll with unmanaged code. Any recognition results delivered from the Intrada.NET library originate one-to-one from the original recognition in the intrada.dll and no new information is added.
- You can use an instance of the IntradaALPR class to initiate connection to the library. For each thread one RecognitionContext should be created. This context provides and method from recognition.
- Although you can already use IntradaALPR from multiple threads through RecognitionContext instances, for easy usage of multithreaded processing the library also provides the interface class ThreadedIntradaALPR that arranges for the threading and queuing.
- The company name and key used for initialization should match the license as provided by Q-Free.
- You do not need to clean up memory and objects explicitly. Freeing of memory and closing of library is arranged for automatically.
- The library already contains brief documentation for each class and method. In Visual Studio you can use the Intellisense tooltips to inspect them.
- Error handling is always arranged for by throwing IntradaException objects.
To start using the Intrada.NET library, store your Intrada package (intrada.dll, intrada.lic, intrada_cm_XX.dll, setting.txt, etc) in the target folder. Second, store the IntradaALPR.dll .NET library in the same target folder.
Then, for development, add IntradaALPR.dll as reference to your project and use objects in the IntradaALPR namespace to use the ALPR functionality. The compiled executable or library will be able to run from the folder you stored the Intrada package and IntradaALPR.dll.
Below two basic minimal examples (C# and VB.NET) to initiate recognition with the Intrada .NET libary from your own application.
The Intrada ALPR library has been designed to work in a multi-threaded environment, enabling the possibilities of parallel OCR processing on multiple cores. Therefore the library is thread-safe, which means after initialization multiple threads can synchronously initiate recognitions. The dll provides two ways of interaction:
- IntradaALPR: Via the IntradaALPR class you can initiate recognition from a single thread, or initiate recognition from multiple threads – taking care of thread maintenance and queuing yourself.
- ThreadedIntradaALPR: Via the ThreadedIntradaALPR class you can initiate recognition from a single thread, where the work is automatically distributed over multiple threads.
Distributing recognition over multiple processing cores can significantly increase the throughput of Intrada ALPR. To that extent, recognition in the Intrada ALPR library is thread-safe. This means that after initialization from one thread, you can safely run recognition from different threads. The .NET Intrada ALPR library facilitates such parallel recognition in various ways.
In case you would like images to be processed sequentially from your main thread anyway, the best way forward is to use the IntradaALPR class. You create one instance of the IntradaALPR class, create one new RecognitionContext from the IntradaALPR object, and finally call the Recognition method on this single RecognitionContext. You can reuse your RecognitionContext instance for all recognitions in your process.
As Intrada ALPR is thread-safe you can also initiate recognitions from multiple threads in your own application. First, you need to initialize the Intrada library from one thread. Second, you need to create a specific RecognitionContext instance for each different thread. Finally, you can call the Recognize method on the RecognitionContext within the threads. Note that when you would have reused a RecognitionContext between two threads anyway, any calls to Recognize will be handled sequentially, effectively removing all benefits of parallel processing.
Finally, Intrada ALPR also provides an extra layer for conveniently abstracting the multithreading altogether. This ThreadedIntradaALPR class forms an interface to the IntradaALPR class and you can use it to benefit from parallel processing without the need for creating and maintaining threads on your own.
To make use of this functionality, you first create an instance of ThreadedIntradaALPR. In the background, outside the scope of your own application, the Threads and corresponding RecognitionContext instances are created. All you need to do further is to call Recognize on the ThreadedIntradaALPR instance.
Below three examples of using these methods for parallel processing. The first one splits the JPG images i a folder 50/50 over two inline threads. The second one lets Intrada distribute the total load optimally over four threads. The third one is a “hotfolder” implementation with Intrada distributing the load optimally over four threads.