The SDK includes two example Analytics Plugins: the simple Sample Analytics Plugin, and the comprehensive Stub Analytics Plugin, in the samples/ directory of the SDK.
Sample Analytics Plugin
Sample Analytics Plugin, located in samples/sample_analytics_plugin, is probably the simplest Plugin that can do something noticeable. All it does is receive video frames from Nx Witness Server, ignore their contents, and produce a "detected object" on each frame — a rectangle that moves diagonally across the frame.
The main purpose of Sample Analytics Plugin is to test if the Plugin subsystem and the Analytics subsystem of Nx Witness work.
If you start developing a relatively simple Analytics Plugin (from the SDK point of view), you may use Sample Analytics Plugin as the starting point, having copied and renamed it, and add some missing features from Stub Analytics Plugin.
A pre-built Sample Analytics Plugin comes with the Server distribution, and is located as follows (for a default Nx Witness installation):
C:\Program Files\Network Optix\Nx Witness\MediaServer\plugins_optional
You may build your own Sample Analytics Plugin from the sources provided in the SDK as described in Building your Plugin. The only technical difference between the dynamic libraries is that the one built from the SDK does not depend on any dynamic libraries, and is linked with nx_kit statically; while the one with the Nx Witness Server distribution because it was built as part of the VMS project, depends on the dynamic library of nx_kit which also comes with the Server distribution.
To activate Sample Analytics Plugin (as it’s in plugins_optional/ and doesn’t load by default) and see it working, perform the following steps:
- Allow the Server to load the Plugin as follows.
- Option A (recommended):
- Create an empty vms_server_plugins.ini in the .ini file directory (if it does not exist yet), and restart the Server. The file will be filled with the default values and detailed comments.
- Modify vms_server_plugins.ini to have the following line:
- Option B (easiest):
- Copy or move Plugin's dynamic library (sample_analytics_plugin.dll on Windows, libsample_analytics_plugin.so on Linux) from plugins_optional/ to plugins/
- Restart Nx Witness Server.
- In Nx Witness Desktop, open a camera on the layout. Make sure the video starts playing.
- Right-click the camera video and select Camera Settings.
- Go to the Plugins tab, choose Sample Analytics Plugin, and turn on the on/off switch.
- In the Notification Panel of Nx Witness Desktop, open the Objects tab — click the button at the top with the square chip symbol.
- Watch the moving rectangle on the video, and the corresponding "object" tiles appearing in the right panel.
If you want to use the Sample Analytics Plugin that you built from the SDK, you can copy it to the plugins/ directory, and perform the steps above, starting from step 3.
Make sure that the original Sample Analytics Plugin is not active (i.e. step 2 is not in effect) because Nx Witness Server cannot load two Plugins with the same Plugin Id.
Alternatively, you can copy and rename Sample Analytics Plugin, including the id and name in its manifest which is hard-coded in the C++ code of the Plugin.
If you notice your Analytics Plugin doesn’t appear in the Plugins tab in Camera Settings at some point during its development, we recommend performing the steps above with the Sample Analytics Plugin; if it works, then investigate the differences between it and your plugin.
Stub Analytics Plugin
Stub Analytics Plugin, located in samples/stub_analytics_plugin, is a Plugin that attempts to utilize almost all the features present in the SDK. It doesn’t perform any real video analysis, but it can produce different types of metadata and has many settings.
The main purpose of Stub Analytics Plugin is to test all the features of the SDK. If you start developing a complex Analytics Plugin, you can use Stub Analytics Plugin as a starting point (having copied and renamed it) and strip the features you don’t plan to use.
To build and activate Stub Analytics Plugin, perform the same steps done with Sample Analytics Plugin.
Note: In the Plugins tab of the Camera Settings dialog, you may see many settings for Stub Analytics Plugin; specifically, its DeviceAgent (Camera-specific settings). They form two distinct groups:
- Real Stub DeviceAgent settings which contain options that influence how the Plugin works (e.g. which metadata to generate and how often); and
- Example Stub DeviceAgent settings which contain the settings of various types needed only to test the Settings mechanism itself.
To get help from our support team in the event Nx Witness Server behaves unexpectedly, perform the following:
- Modify the source code of Stub Analytics Plugin or Sample Analytics Plugin to achieve the same effect, if possible.
- Contact the support team and provide the modified Plugin source code.