VisionWorks Toolkit Reference

September 29, 2015 | 1.0 Release

 All Data Structures Namespaces Files Functions Variables Typedefs Enumerations Enumerator Macros Groups Pages

This section demonstrates user custom node creation.

You must add a factory method that will create node objects.

The factory method must accept Object: Graph as the first parameter:

vx_node keypointArraySortNode(vx_graph graph, vx_array src, vx_array dst, vx_scalar use_strength)

The node creation is done in 3 steps:

5.1. Get kernel object by its identifier:

vx_kernel kernel = vxGetKernelByEnum(context, USER_KERNEL_KEYPOINT_ARRAY_SORT);

5.2. Create node object from the kernel object:

node = vxCreateGenericNode(graph, kernel);
vxReleaseKernel(&kernel);

5.3. Set node parameters:

The Full Code for the Node Factory Method

vx_node keypointArraySortNode(vx_graph graph, vx_array src, vx_array dst, vx_scalar use_strength)
{
vx_node node = NULL;
vx_kernel kernel = vxGetKernelByEnum(context, USER_KERNEL_KEYPOINT_ARRAY_SORT);
{
node = vxCreateGenericNode(graph, kernel);
vxReleaseKernel(&kernel);
{
vxSetParameterByIndex(node, 2, (vx_reference)use_strength);
}
}
return node;
}