VisionWorks Toolkit Reference

September 29, 2015 | 1.0 Release

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

Detailed Description

Adds various extensions to the vx_graph object.

This section describes different extensions and features to the standard Object: Graph.

Asynchronous Graph Execution

vxWaitGraph blocks the calling thread until the graph that was previously launched by vxScheduleGraph finishes processing.

Enumerations

enum  nvx_graph_attribute_e {
  NVX_GRAPH_VERIFY_OPTIONS = VX_ENUM_BASE(VX_ID_NVIDIA, VX_TYPE_GRAPH) + 0x0,
  NVX_GRAPH_VERIFY_NEEDED = VX_ENUM_BASE(VX_ID_NVIDIA, VX_TYPE_GRAPH) + 0x1
}
 The extended graph attributes list. More...
 

Functions

vx_graph nvxCreateStreamGraph (vx_context context)
 Creates an empty graph as a node stream. More...
 
vx_status nvxRegisterAutoAging (vx_graph graph, vx_delay delay)
 Registers a delay for auto-aging. More...
 

Enumeration Type Documentation

The extended graph attributes list.

Enumerator
NVX_GRAPH_VERIFY_OPTIONS 

Sets the graph verification options.

Use a vx_char * parameter.

Supported options:

  • -O0 - Sets the graph optimization level to 0.
  • -O1 - Sets the graph optimization level to 1.
  • -O2 - Sets the graph optimization level to 2.
  • -O3 - Sets the graph optimization level to 3.
  • --dot <file prefix> - Generates dot file representation for the graph.
Example Code
vx_char graph_options[] = "-O3 --dot /home/user/my_graph";
vxSetGraphAttribute(graph, NVX_GRAPH_VERIFY_OPTIONS, graph_options, sizeof(graph_options));
NVX_GRAPH_VERIFY_NEEDED 

Informs if graph verification is needed before graph execution.

Use a vx_bool parameter.

Graph verification may be needed in multiple situations, for example

  • when it has never been verified
  • when a change in the graph (node removal, node parameter change) changes its connectivity
  • when a node parameter is changed with an other one that has different meta-data
  • when an immutable node parameter is modified by the application

The OpenVX implementation automatically detects when a graph (re)verification is needed and will automatically verify the graph if needed when the application requests a graph execution.

This attribute provides the current verification requirement status to the application.

Definition at line 454 of file nvx.h.

Function Documentation

vx_graph nvxCreateStreamGraph ( vx_context  context)

Creates an empty graph as a node stream.

A stream-graph only differs from a standard OpenVX graph by the fact that its semantics is determined by the behavior that would have the sequential execution of nodes in the order they have been created (this order does not matter for a standard graph). The stream-graph then relaxes the single-assignment rule of the standard graph, and a data object is allowed to be written multiple times in a stream-graph.

VisionWorks applies to a stream-graph the same optimizations as to a standard graph, but ensures its semantics is preserved.

Note
A node cannot be removed from a stream-graph.
A stream graph assumes that a data object written by a node may be entirely modified by the node and then VisionWorks does not change execution order of two nodes writing the same data object.
Example Code
vx_graph graph = nvxCreateStreamGraph(context);
// In stream graph we can have multiple writers.
// a += b
// a += alpha * c
vxAccumulateImageNode(graph, b, a);
vxAccumulateWeightedImageNode(graph, c, alpha, a);
Parameters
[in]contextThe reference to the implementation context.
Returns
A valid graph reference or an error object (use vxGetStatus).
vx_status nvxRegisterAutoAging ( vx_graph  graph,
vx_delay  delay 
)

Registers a delay for auto-aging.

This function registers a delay object to be auto-aged by the graph. This delay object gets automatically aged after each successful completion of this graph. A graph restart due to a node callback does not trigger auto-aging. A graph abandon due to a node callback does not trigger auto-aging.

If a delay object is registered for auto-aging multiple times in the same graph, the delay is aged only a single time after each successful completion of the graph. If a delay object is registered for auto-aging in multiple graphs, this delay is aged automatically after each successful completion of any of these graphs.

Example Code
vx_graph graph = vxCreateGraph(context);
vx_pyramid pyr_exemplar = vxCreatePyramid(context, pyr_levels, VX_SCALE_PYRAMID_HALF, width, height, VX_DF_IMAGE_U8);
vx_delay pyr_delay = vxCreateDelay(context, (vx_reference)pyr_exemplar, 2);
vxReleasePyramid(&pyr_exemplar);
vx_array pts_exemplar = vxCreateArray(context, NVX_TYPE_POINT2F, 3000);
vx_delay pts_delay = vxCreateDelay(context, (vx_reference)pts_exemplar, 2);
vxReleaseArray(&pts_exemplar);
// Build pyramid for current image
src,
// Calculate optical flow between current and previous images
VX_TERM_CRITERIA_BOTH, lk_epsilon, lk_num_iters, lk_use_init_est, lk_win_size);
nvxRegisterAutoAging(graph, pyr_delay);
nvxRegisterAutoAging(graph, pts_delay);
// The delays will be aged automatically
Parameters
[in]graphThe graph to which the delay gets registered for auto-aging.
[in]delayThe delay to automatically age.
Returns
A vx_status enumerator.
Return values
VX_SUCCESSNo errors.
VX_ERROR_INVALID_REFERENCEIf the graph or delay is not a valid reference.