Creating components🔗

To be able to distribute your apps through the VisionAppster Store or install them to the Engine, you need to create a component and store it in a component package.

The component package is a zip file with a known directory structure. Each component in the package is described by a component.json file. The Builder provides a user interface for creating a component package out of the current app directly. If you want to create other types of components, you need to create the directory structure manually and then use the Builder or a command-line tool to compile the package file.

Packaging apps🔗

We’ll use the Monochromatizer app as an example again. First, open it in the Builder.

As a first step, we’ll give our app a component ID. The component ID will uniquely identify the app and its API. Select “File” → “App properties…” in the menu and change the auto-generated default component ID to “com.example.monochromatizer”. If you want sell or provide the app as a free component in the VisionAppster Store, you also need to register the component ID there.

Give the app a unique component ID.

Give the app a unique component ID.🔗

Save the app with Ctrl+S. Select “File” → “Package this app…” in the menu. Give the component a name, open the “Local” section and pick a target folder. Then click “Create”.

Creating a component out of an app is straightforward.

Creating a component out of an app is straightforward.🔗

Congratulations! You have finished created your first functional vision app. The package is ready to be installed with va-pkg or via the web interface.

If you used the default target folder, opening the web-based management interface in a browser (http://localhost:2020/ by default) will show your component package in uploaded packages. Alternatively, you can upload the package to a running remote engine instance directly on the “Remote” section of the dialog.

Packaging tool plugins🔗

The Builder provides no GUI for creating the file system structure for components other than apps. But fear not, creating other types of components is still simple.

The VisionAppster SDK comes with a ready-to-build tool plugin that wraps some OpenCV functions. As a prerequisite, you should build that plugin as instructed here.

The build process will create myopencv.toolplugin in sdk/examles/opencv/build. To make the plugin library a component, you need to create a specially named directory and put the file there.

  • Windows

    md myopencv-1\windows-x86_64
    copy sdk\examples\opencv\build\myopencv.toolplugin myopencv-1\windows-x86_64
    
  • Linux

    mkdir -p myopencv-1/linux-x86_64
    cp sdk/examples/opencv/build/myopencv.toolplugin myopencv-1/linux-x86_64
    

Tool plugins must have file extension .toolplugin. When a component package is created, files with that extension are marked as toolplugin in the package manifest file and thus installed in the tool plugin directory.

The examples are configured to build the plugin libraries with that extension, so there is no need to manually change it prior to the package creation.

When building component packages, directory names mostly don’t matter. Binary plugins must however be compiled for each supported target architecture separately and put under paths that include one of the known architecture identifiers. This lets the package builder automatically detect the target architecture. For more details, see the cross-compilation instructions.

Here is an example of the source folder contents for a package with a plugin binary for two different architectures:

/myopencv-1/windows-x86_64/myopencv.toolplugin
/myopencv-1/linux-x86_64/myopencv.toolplugin

When a package like this is installed, the installer will only copy the files matching the architecture of the running machine.

The final step is to create a component package in the builder. Click “File” → “Package a folder…”. Give the component a name and select the myopencv-1 directory.

Once you have the files, you just need to fill in component ID and version.

Once you have the files, you just need to fill in component ID and version.🔗

Make sure to enter the correct component ID (com.example.opencv) and version number (1.0.0). Then pick a target directory in the “Local” section and click “Create”. Done.