VisionWorks Toolkit Reference

December 18, 2015 | 1.2 Release

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

Adds various extensions to the vx_array object.

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

Array Access

In VisionWorks, arrays can be accessed from the CUDA device memory in addition to the host CPU memory defined in the OpenVX specification. For this, the application must use CUDA-specific accessors nvx_accessor_e for the usage parameter of function vxAccessArrayRange .

Example Code

vx_array array = vxCreateArray(context, VX_TYPE_KEYPOINT, 1000);
vx_keypoint_t *cudaKp = NULL;
vx_size stride = 0;
vx_size num_items = 0;
detectKeypoints(image, array);
vxQueryArray(array, VX_ARRAY_ATTRIBUTE_NUMITEMS, &num_items, sizeof(num_items));
vxAccessArrayRange(array, 0, num_items, &stride, (void**) &cudaKp, NVX_READ_ONLY_CUDA);
dim3 block(1, 1);
dim3 grid(num_items, 1);
processKeypoint<<<grid, block, 0, stream>>>(cudaKp, stride, cudaOutputBuffer);
vxCommitArrayRange(array, 0, num_items, cudaKp);
See also
CUDA Interoperability