VisionWorks Toolkit Reference

September 29, 2015 | 1.0 Release

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

Detailed Description

Adds various extensions to the vx_image object.

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

Image Size Limitation

Image dimensions in VisionWorks implementations must not exceed INT32_MAX.

Images Import

In VisionWorks, the vxCreateImageFromHandle function can import images from:

In both cases, the imported memory must satisfy the following memory layout conditions:

Warning
The application must use access/commit methods when working with the imported image, as it does with the normal image, even when accessing it through an imported pointer. Access/commit methods notify the framework about image access, so the framework can do appropriate buffer synchronization internally.
If the application works with imported memory without access/commit methods, it will result in an undefined behavior.
See also
CUDA Interoperability
Import NV12 Image from CUDA Address Space

Image Access

In VisionWorks, images 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 vxAccessImagePatch .

Example Code

vx_uint8 *cudaInputPtr = NULL;
vx_uint8 *cudaOutputPtr = NULL;
vx_rectangle_t rect = { 0, 0, 640, 400 };
vxAccessImagePatch(input_image, &rect, 0, &addrInput, (void **)&cudaInputPtr, NVX_READ_ONLY_CUDA);
vxAccessImagePatch(output_image, &rect, 0, &addrOutput, (void **)&cudaOutputPtr, NVX_WRITE_ONLY_CUDA);
dim3 block(1, 1);
dim3 grid(640, 400);
myKernel<<<grid, block, 0, stream>>>(cudaInputPtr, addrInput.stride_x, addrInput.stride_y,
cudaOutputPtr, addrOutput.stride_x, addrOutput.stride_y);
vxCommitImagePatch(input_image, &rect, 0, &addrInput, cudaInputPtr);
vxCommitImagePatch(output_image, &rect, 0, &addrOutput, cudaOutputPtr);
See also
CUDA Interoperability

Enumerations

enum  nvx_df_image_e {
  NVX_DF_IMAGE_F32 = VX_DF_IMAGE('F','0','3','2'),
  NVX_DF_IMAGE_2F32 = VX_DF_IMAGE('2','F','3','2'),
  NVX_DF_IMAGE_RGB16 = VX_DF_IMAGE('S','3','1','6')
}
 Defines additional image formats. More...
 

Functions

vx_image nvxCreateImageFromChannel (vx_image imgref, vx_channel_e channel)
 Creates an image from a single channel of another image. More...
 

Enumeration Type Documentation

Defines additional image formats.

Enumerator
NVX_DF_IMAGE_F32 

A single plane of vx_float32 data.

NVX_DF_IMAGE_2F32 

A single plane of vx_float32[2] data (eg.

motion fields).

NVX_DF_IMAGE_RGB16 

A single plane of 48 bit pixels as 3 interleaved 16 bit signed integers of R then G then B data.

Definition at line 274 of file nvx.h.

Function Documentation

vx_image nvxCreateImageFromChannel ( vx_image  imgref,
vx_channel_e  channel 
)

Creates an image from a single channel of another image.

This second image refers to the data in the original image. Updates to this image updates the parent image.

The method supports only multi-planar images (YUV4, IYUV, NV12, NV21) and only channels that occupy an entire plane.

Parameters
[in]imgrefSpecifies the parent image.
[in]channelSpecifies the channel to use.
Returns
vx_image object.