C++ Plugin API
The C++ Plugin API is a pluggable API designed to allow the succinct expression of biometrics algorithms as a series of independent plugins. The API exposes a number of data structures and plugin abstractions to use as simple building blocks for complex algorithms.
Data Structures
The API defines two data structures:
Files are used for storing textual data and Templates act as containers that hold images, stored as OpenCV Mats, and Files.
Plugin Abstractions
A plugin in OpenBR is defined as classes which modify, interpret, or assist with the modification of OpenBR compatible images and/or metadata. All OpenBR plugins have a common ancestor, Object, and they all are constructed from string descriptions given by Files. There are 8 base abstractions that derive from Object and should be the parent for all production plugins. They are:
| Plugin | Function |
|---|---|
| Initializer | Initializes shared contexts and variables at the launch of OpenBR. Mostly useful for 3rdparty plugin additions. |
| Transform | The most common plugin type in OpenBR. Transforms images or metadata. |
| Distance | Finds the distance between templates. |
| Format | Used for I/O. Formats handle output types that correspond to single objects, for example .jpg, .png etc. |
| Gallery | Used for I/O. Galleries handle output types that correspond to many objects, for example .csv. .xml etc. |
| Output | Used for I/O. Outputs handle the results of Distance comparisons. |
| Representation | Converts images into feature vectors. Slightly different then Transforms in implementation and available API calls. |
| Classifier | Classifies feature vectors as members of specific classes |
Additionally, there are several child-abstractions for specific use cases. They are:
| Plugin | Parent | Function |
|---|---|---|
| UntrainableTransform | Transform | A Transform that cannot be trained |
| MetaTransform | Transform | A Transform that is not independent |
| UntrainableMetaTransform | UntrainableTransform | A Transform that is not independent and cannot be trained |
| MetadataTransform | Transform | A Transform that operates only on Template metadata |
| UntrainableMetadataTransform | MetadataTransform | A MetadataTransform that cannot be trained |
| TimeVaryingTransform | Transform | A Transform that changes at runtime as a result of the input |
| UntrainableDistance | Distance | A Distance that cannot be trained |
| FileGallery | Gallery | DOCUMENT ME |
| MatrixOutput | Output | A Output that outputs data as a matrix |
As was stated before, all plugins in OpenBR are constructed using strings stored as Files. The construction is done at runtime by a Factory class. The Factory expects strings of the form "PluginName(property1=value1,propert2=value2...propertyN=valueN)". It then looks up the "PluginName" in a static registry and builds the plugin if found. The registry is populated using a special macro BR_REGISTER; each plugin needs to register itself and its base abstraction in the factory to enable construction. The purpose of this is to allow algorithms to be described completely by strings. For more information on algorithms in OpenBR please see the tutorial