When new OpenVX* project is created, all the available kernels for the selected OpenVX* runtime are enumerated in the Kernels List Window. More kernels can be added to this window and then instantiated in the graph by adding a user kernels library to the project.
This chapter explains how to develop an OpenVX* user kernels library with Eclipse.
Development of an OpenVX* user kernel library can be done by creating a regular C project, adding the required include directories and manual writing the OpenVX boilerplate code such as validation callbacks.
For User Kernel development instructions, refer to the Intel® Computer Vision SDK Samples documentation.
Another option is to create an OpenVX* user kernels project. OpenVX* user kernels project is a regular C project that consists of several files described in this chapter.
Creating an OpenVX* user kernel project automatically generates the OpenVX boilerplate code that is required for writing a user kernel. All you need is to implement the missing parts.
Opening the New User Kernel Project Wizard
To create a new project of OpenVX* user kernels, you can use the New User Kernels Project wizard. Use one of the available options to launch this wizard:
- Click the File menu and choose New -> Other -> OpenVX -> User Kernel Project.
- Right click anywhere in the Project Explorer and choose New -> Project -> Other… -> OpenVX -> User Kernel Project.
- Click the New button () in the toolbar and choose OpenVX -> User Kernels Project.
Using the New User Kernel Project Wizard
In The User Kernel Project wizard:
- Enter the Project name.
- Click the Edit Kernel button to open a User kernel stub generator dialog:
- In the Library Definitions section:
- Enter the Library Name to be generated.
- Enter the Library ID to be used as a base for the kernel enumeration construct.
- Enter the OpenVX* Version. The wizard enables generating a stub for OpenVX* 1.01 and for OpenVX* 1.1. The current version is selected by default.
- Enter the Kernel Name to be generated.
- Enter the Kernel ID - the ID which is part of the kernel enumeration construct.
- Enter the Kernel Name Prefix.
- Double-click on each field to enable editing the selected parameter.
- Enter the Type of the parameter.
- Enter the Name of the parameter to be used in the kernel module functions.
- Select Is-Required to be true if the parameter is mandatory. Otherwise select false.
- Specify if the parameter is used as Input or Output.
- Enter a Description to be used as the parameter documentation in the kernel module functions.
- Click Add to add a new parameter to the end of the parameter table.
- Click Delete to delete the current parameter.
- Click Clear to clear all parameters.
generated_stubfolder with the generated code will be created.
- Mark the Generate publish kernels option to add
publish_kernels.cwith an entry point that will be called to load the user kernel library. If this kernel is meant to be added to an existing library, this option can be checked out.
- Mark the Generate a make file and a build script option to generate the
Select Yes to add the current kernel stub to the existing library (note, the library header and
will be regenerated).
Select No to override the library.
Viewing the Newly Created Project
The Project Explorer shows the newly created user kernels project.
The created project contains the following files:
<Kernel Type Name>.h- Contains the kernel short and full name definitions and the node/vxu declarations for the kernel as well as
add<Kernel Type Name>function that can be called to add the kernel
<Kernel Type Name>_lib.c- Contains the implementation for the node/vxu functions
<Kernel Type Name>_module.c- Contains the parameter enumeration definition and the implementation of the actual kernel code (input validation, output validation, kernel logic, initialize and de-initialize functions)
publish_kernels.c- Contains the main entry point (
vxPublishKernels) that is called to load the user kernel library.