The OpenVX Specification  2b213f9
 All Data Structures Functions Variables Typedefs Enumerations Enumerator Groups Pages
Framework: Graph Parameters

Detailed Description

Defines the Graph Parameter API.

Graph parameters allow Clients to create graphs with Client settable parameters. Clients can then create Graph creation methods (a.k.a. Graph Factories). When creating these factories, the client will typically not be able to use the standard Node creator functions such as vxSobel3x3Node but instead will use the manual method via vxCreateGenericNode.

vx_graph vxCornersGraphFactory(vx_context context)
vx_float32 strength_thresh = 10000.0f;
vx_float32 r = 1.5f;
vx_float32 sensitivity = 0.14f;
vx_int32 window_size = 3;
vx_int32 block_size = 3;
vx_enum channel = VX_CHANNEL_Y;
vx_graph graph = vxCreateGraph(context);
vx_image virts[] = {
vx_kernel kernels[] = {
vx_node nodes[dimof(kernels)] = {
vxCreateGenericNode(graph, kernels[0]),
vxCreateGenericNode(graph, kernels[1]),
vxCreateGenericNode(graph, kernels[2]),
vx_scalar scalars[] = {
vxCreateScalar(context, VX_TYPE_ENUM, &channel),
vxCreateScalar(context, VX_TYPE_FLOAT32, &strength_thresh),
vxCreateScalar(context, VX_TYPE_FLOAT32, &sensitivity),
vxCreateScalar(context, VX_TYPE_INT32, &window_size),
vxCreateScalar(context, VX_TYPE_INT32, &block_size),
vx_parameter parameters[] = {
vxGetParameterByIndex(nodes[0], 0),
vxGetParameterByIndex(nodes[2], 6)
// Channel Extract
status |= vxAddParameterToGraph(graph, parameters[0]);
status |= vxSetParameterByIndex(nodes[0], 1, (vx_reference)scalars[0]);
status |= vxSetParameterByIndex(nodes[0], 2, (vx_reference)virts[0]);
// Median Filter
status |= vxSetParameterByIndex(nodes[1], 0, (vx_reference)virts[0]);
status |= vxSetParameterByIndex(nodes[1], 1, (vx_reference)virts[1]);
// Harris Corners
status |= vxSetParameterByIndex(nodes[2], 0, (vx_reference)virts[1]);
status |= vxSetParameterByIndex(nodes[2], 1, (vx_reference)scalars[1]);
status |= vxSetParameterByIndex(nodes[2], 2, (vx_reference)scalars[2]);
status |= vxSetParameterByIndex(nodes[2], 3, (vx_reference)scalars[3]);
status |= vxSetParameterByIndex(nodes[2], 4, (vx_reference)scalars[4]);
status |= vxSetParameterByIndex(nodes[2], 5, (vx_reference)scalars[5]);
status |= vxAddParameterToGraph(graph, parameters[1]);
for (i = 0; i < dimof(scalars); i++)
for (i = 0; i < dimof(virts); i++)
for (i = 0; i < dimof(kernels); i++)
for (i = 0; i < dimof(nodes);i++)
for (i = 0; i < dimof(parameters); i++)
return graph;

Some data are contained in these Graphs and do not become exposed to Clients of the factory. This allows ISVs or Vendors to create custom IP or IP-sensitive factories that Clients can use but may not be able to determine what is inside the factory. As the graph contains internal references to the data, the objects will not be freed until the graph itself is released.


vx_status VX_API_CALL vxAddParameterToGraph (vx_graph graph, vx_parameter parameter)
 Adds the given parameter extracted from a vx_node to the graph. More...
vx_parameter VX_API_CALL vxGetGraphParameterByIndex (vx_graph graph, vx_uint32 index)
 Retrieves a vx_parameter from a vx_graph. More...
vx_status VX_API_CALL vxSetGraphParameterByIndex (vx_graph graph, vx_uint32 index, vx_reference value)
 Sets a reference to the parameter on the graph. The implementation must set this parameter on the originating node as well. More...

Function Documentation

vx_status VX_API_CALL vxAddParameterToGraph ( vx_graph  graph,
vx_parameter  parameter 

Adds the given parameter extracted from a vx_node to the graph.

[in]graphThe graph reference that contains the node.
[in]parameterThe parameter reference to add to the graph from the node.
A vx_status_e enumeration.
Return values
VX_SUCCESSParameter added to Graph.
VX_ERROR_INVALID_REFERENCEThe parameter is not a valid vx_parameter.
VX_ERROR_INVALID_PARAMETERThe parameter is of a node not in this graph.
vx_status VX_API_CALL vxSetGraphParameterByIndex ( vx_graph  graph,
vx_uint32  index,
vx_reference  value 

Sets a reference to the parameter on the graph. The implementation must set this parameter on the originating node as well.

[in]graphThe graph reference.
[in]indexThe parameter index.
[in]valueThe reference to set to the parameter.
A vx_status_e enumeration.
Return values
VX_SUCCESSParameter set to Graph.
VX_ERROR_INVALID_REFERENCEThe value is not a valid vx_reference.
VX_ERROR_INVALID_PARAMETERThe parameter index is out of bounds or the dir parameter is incorrect.
vx_parameter VX_API_CALL vxGetGraphParameterByIndex ( vx_graph  graph,
vx_uint32  index 

Retrieves a vx_parameter from a vx_graph.

[in]graphThe graph.
[in]indexThe index of the parameter.
vx_parameter reference. Any possible errors preventing a successful creation should be checked using vxGetStatus.
Return values
0if the index is out of bounds.
*The parameter reference.