This section demonstrates user custom kernel registration.
You must register the new kernel in a context object (Object: Context).
Each kernel has 2 identifiers:
- string (like
"user.kernel.keypoint_array_sort"
) and
- enumeration (like
USER_KERNEL_KEYPOINT_ARRAY_SORT
).
You must define both identifiers:
enum {
USER_LIBRARY = 0x1,
};
vx_char keypoint_array_sort_name[] =
"user.kernel.keypoint_array_sort";
- Note
- If the user custom node is implemented on CUDA or it uses CUDA libraries, use gpu: prefix for the kernel name to notify the framework that the kernel should be assigned to a GPU target:
vx_char keypoint_array_sort_name[] =
"gpu:user.kernel.keypoint_array_sort";
Do the registration in 3 steps:
4.1. Create kernel object:
keypointArraySort_kernel,
num_params,
keypointArraySort_input_validate,
keypointArraySort_output_validate,
NULL,
NULL
);
{
return status;
}
4.2. Add parameters description to the newly created kernel object:
4.3. Finalize the kernel:
The Full Code for the Node Registration
enum {
USER_LIBRARY = 0x1,
};
vx_char keypoint_array_sort_name[] =
"user.kernel.keypoint_array_sort";
{
keypointArraySort_kernel,
num_params,
keypointArraySort_input_validate,
keypointArraySort_output_validate,
NULL,
NULL
);
{
return status;
}
{
}
{
}
return status;
}