![]() |
The OpenVX Specification
r31169
|
Defines the Image Object interface.
Data Structures | |
struct | vx_imagepatch_addressing_t |
The addressing image patch structure is used by the Host only to address pixels in an image patch. The fields of the structure are defined as: More... | |
Macros | |
#define | VX_IMAGEPATCH_ADDR_INIT {0u, 0u, 0, 0, 0u, 0u, 0u, 0u} |
Use to initialize a vx_imagepatch_addressing_t structure on the stack. | |
Typedefs | |
typedef struct _vx_image * | vx_image |
An opaque reference to an image. More... | |
Enumerations | |
enum | vx_channel_range_e { VX_CHANNEL_RANGE_FULL = ((( VX_ID_KHRONOS ) << 20) | ( VX_ENUM_COLOR_RANGE << 12)) + 0x0, VX_CHANNEL_RANGE_RESTRICTED = ((( VX_ID_KHRONOS ) << 20) | ( VX_ENUM_COLOR_RANGE << 12)) + 0x1 } |
The image channel range list used by the VX_IMAGE_ATTRIBUTE_RANGE attribute of a vx_image . More... | |
enum | vx_color_space_e { VX_COLOR_SPACE_NONE = ((( VX_ID_KHRONOS ) << 20) | ( VX_ENUM_COLOR_SPACE << 12)) + 0x0, VX_COLOR_SPACE_BT601_525 = ((( VX_ID_KHRONOS ) << 20) | ( VX_ENUM_COLOR_SPACE << 12)) + 0x1, VX_COLOR_SPACE_BT601_625 = ((( VX_ID_KHRONOS ) << 20) | ( VX_ENUM_COLOR_SPACE << 12)) + 0x2, VX_COLOR_SPACE_BT709 = ((( VX_ID_KHRONOS ) << 20) | ( VX_ENUM_COLOR_SPACE << 12)) + 0x3, VX_COLOR_SPACE_DEFAULT = VX_COLOR_SPACE_BT709 } |
The image color space list used by the VX_IMAGE_ATTRIBUTE_SPACE attribute of a vx_image . More... | |
enum | vx_image_attribute_e { VX_IMAGE_ATTRIBUTE_WIDTH = ((( VX_ID_KHRONOS ) << 20) | ( VX_TYPE_IMAGE << 8)) + 0x0, VX_IMAGE_ATTRIBUTE_HEIGHT = ((( VX_ID_KHRONOS ) << 20) | ( VX_TYPE_IMAGE << 8)) + 0x1, VX_IMAGE_ATTRIBUTE_FORMAT = ((( VX_ID_KHRONOS ) << 20) | ( VX_TYPE_IMAGE << 8)) + 0x2, VX_IMAGE_ATTRIBUTE_PLANES = ((( VX_ID_KHRONOS ) << 20) | ( VX_TYPE_IMAGE << 8)) + 0x3, VX_IMAGE_ATTRIBUTE_SPACE = ((( VX_ID_KHRONOS ) << 20) | ( VX_TYPE_IMAGE << 8)) + 0x4, VX_IMAGE_ATTRIBUTE_RANGE = ((( VX_ID_KHRONOS ) << 20) | ( VX_TYPE_IMAGE << 8)) + 0x5, VX_IMAGE_ATTRIBUTE_SIZE = ((( VX_ID_KHRONOS ) << 20) | ( VX_TYPE_IMAGE << 8)) + 0x6 } |
The image attributes list. More... | |
Functions | |
vx_status VX_API_CALL | vxAccessImagePatch (vx_image image, const vx_rectangle_t *rect, vx_uint32 plane_index, vx_imagepatch_addressing_t *addr, void **ptr, vx_enum usage) |
Allows the User to extract a rectangular patch (subset) of an image from a single plane. More... | |
vx_status VX_API_CALL | vxCommitImagePatch (vx_image image, vx_rectangle_t *rect, vx_uint32 plane_index, vx_imagepatch_addressing_t *addr, const void *ptr) |
This allows the User to commit a rectangular patch (subset) of an image from a single plane. More... | |
vx_size VX_API_CALL | vxComputeImagePatchSize (vx_image image, const vx_rectangle_t *rect, vx_uint32 plane_index) |
This computes the size needed to retrieve an image patch from an image. More... | |
vx_image VX_API_CALL | vxCreateImage (vx_context context, vx_uint32 width, vx_uint32 height, vx_df_image color) |
Creates an opaque reference to an image buffer. More... | |
vx_image VX_API_CALL | vxCreateImageFromHandle (vx_context context, vx_df_image color, vx_imagepatch_addressing_t addrs[], void *ptrs[], vx_enum import_type) |
Creates a reference to an image object that was externally allocated. More... | |
vx_image VX_API_CALL | vxCreateImageFromROI (vx_image img, const vx_rectangle_t *rect) |
Creates an image from another image given a rectangle. This second reference refers to the data in the original image. Updates to this image updates the parent image. The rectangle must be defined within the pixel space of the parent image. More... | |
vx_image VX_API_CALL | vxCreateUniformImage (vx_context context, vx_uint32 width, vx_uint32 height, vx_df_image color, const void *value) |
Creates a reference to an image object that has a singular, uniform value in all pixels. More... | |
vx_image VX_API_CALL | vxCreateVirtualImage (vx_graph graph, vx_uint32 width, vx_uint32 height, vx_df_image color) |
Creates an opaque reference to an image buffer with no direct user access. This function allows setting the image width, height, or format. More... | |
void *VX_API_CALL | vxFormatImagePatchAddress1d (void *ptr, vx_uint32 index, const vx_imagepatch_addressing_t *addr) |
Accesses a specific indexed pixel in an image patch. More... | |
void *VX_API_CALL | vxFormatImagePatchAddress2d (void *ptr, vx_uint32 x, vx_uint32 y, const vx_imagepatch_addressing_t *addr) |
Accesses a specific pixel at a 2d coordinate in an image patch. More... | |
vx_status VX_API_CALL | vxGetValidRegionImage (vx_image image, vx_rectangle_t *rect) |
Retrieves the valid region of the image as a rectangle. More... | |
vx_status VX_API_CALL | vxQueryImage (vx_image image, vx_enum attribute, void *ptr, vx_size size) |
Retrieves various attributes of an image. More... | |
vx_status VX_API_CALL | vxReleaseImage (vx_image *image) |
Releases a reference to an image object. The object may not be garbage collected until its total reference count is zero. More... | |
vx_status VX_API_CALL | vxSetImageAttribute (vx_image image, vx_enum attribute, const void *ptr, vx_size size) |
Allows setting attributes on the image. More... | |
struct vx_imagepatch_addressing_t |
The addressing image patch structure is used by the Host only to address pixels in an image patch. The fields of the structure are defined as:
VX_SCALE_UNITY
. vxAccessImagePatch
Definition at line 1309 of file vx_types.h.
Data Fields | ||
---|---|---|
vx_uint32 | dim_x | Width of patch in X dimension in pixels. |
vx_uint32 | dim_y | Height of patch in Y dimension in pixels. |
vx_int32 | stride_x | Stride in X dimension in bytes. |
vx_int32 | stride_y | Stride in Y dimension in bytes. |
vx_uint32 | scale_x |
Scale of X dimension. For sub-sampled planes this is the scaling factor of the dimension of the plane in relation to the zero plane. Use VX_SCALE_UNITY in the numerator. |
vx_uint32 | scale_y |
Scale of Y dimension. For sub-sampled planes this is the scaling factor of the dimension of the plane in relation to the zero plane. Use VX_SCALE_UNITY in the numerator. |
vx_uint32 | step_x | Step of X dimension in pixels. |
vx_uint32 | step_y | Step of Y dimension in pixels. |
typedef struct _vx_image* vx_image |
enum vx_image_attribute_e |
The image attributes list.
Enumerator | |
---|---|
VX_IMAGE_ATTRIBUTE_WIDTH |
Queries an image for its height. Use a |
VX_IMAGE_ATTRIBUTE_HEIGHT |
Queries an image for its width. Use a |
VX_IMAGE_ATTRIBUTE_FORMAT |
Queries an image for its format. Use a |
VX_IMAGE_ATTRIBUTE_PLANES |
Queries an image for its number of planes. Use a |
VX_IMAGE_ATTRIBUTE_SPACE |
Queries an image for its color space (see |
VX_IMAGE_ATTRIBUTE_RANGE |
Queries an image for its channel range (see |
VX_IMAGE_ATTRIBUTE_SIZE |
Queries an image for its total number of bytes. Use a |
Definition at line 800 of file vx_types.h.
enum vx_color_space_e |
The image color space list used by the VX_IMAGE_ATTRIBUTE_SPACE
attribute of a vx_image
.
Definition at line 1063 of file vx_types.h.
enum vx_channel_range_e |
The image channel range list used by the VX_IMAGE_ATTRIBUTE_RANGE
attribute of a vx_image
.
Enumerator | |
---|---|
VX_CHANNEL_RANGE_FULL |
Full range of the unit of the channel. |
VX_CHANNEL_RANGE_RESTRICTED |
Restricted range of the unit of the channel based on the space given. |
Definition at line 1080 of file vx_types.h.
vx_image VX_API_CALL vxCreateImage | ( | vx_context | context, |
vx_uint32 | width, | ||
vx_uint32 | height, | ||
vx_df_image | color | ||
) |
Creates an opaque reference to an image buffer.
Not guaranteed to exist until the vx_graph
containing it has been verified.
[in] | context | The reference to the implementation context. |
[in] | width | The image width in pixels. |
[in] | height | The image height in pixels. |
[in] | color | The VX_DF_IMAGE (vx_df_image_e ) code that represents the format of the image and the color space. |
vx_image
. Any possible errors preventing a successful creation should be checked using vxGetStatus
. vx_image VX_API_CALL vxCreateImageFromROI | ( | vx_image | img, |
const vx_rectangle_t * | rect | ||
) |
Creates an image from another image given a rectangle. This second reference refers to the data in the original image. Updates to this image updates the parent image. The rectangle must be defined within the pixel space of the parent image.
[in] | img | The reference to the parent image. |
[in] | rect | The region of interest rectangle. Must contain points within the parent image pixel space. |
vx_image
to the sub-image. Any possible errors preventing a successful creation should be checked using vxGetStatus
. vx_image VX_API_CALL vxCreateUniformImage | ( | vx_context | context, |
vx_uint32 | width, | ||
vx_uint32 | height, | ||
vx_df_image | color, | ||
const void * | value | ||
) |
Creates a reference to an image object that has a singular, uniform value in all pixels.
The value pointer must reflect the specific format of the desired image. For example:
Color | Value Ptr |
---|---|
VX_DF_IMAGE_U8 | vx_uint8 * |
VX_DF_IMAGE_S16 | vx_int16 * |
VX_DF_IMAGE_U16 | vx_uint16 * |
VX_DF_IMAGE_S32 | vx_int32 * |
VX_DF_IMAGE_U32 | vx_uint32 * |
VX_DF_IMAGE_RGB | vx_uint8 pixel[3] in R, G, B order |
VX_DF_IMAGE_RGBX | vx_uint8 pixels[4] |
Any YUV | vx_uint8 pixel[3] in Y, U, V order |
[in] | context | The reference to the implementation context. |
[in] | width | The image width in pixels. |
[in] | height | The image height in pixels. |
[in] | color | The VX_DF_IMAGE (vx_df_image_e) code that represents the format of the image and the color space. |
[in] | value | The pointer to the pixel value to which to set all pixels. |
vx_image
. Any possible errors preventing a successful creation should be checked using vxGetStatus
.
vxAccessImagePatch
to obtain direct memory access to the image data. vxAccessImagePatch
and vxCommitImagePatch
may be called with a uniform image reference. vx_image VX_API_CALL vxCreateVirtualImage | ( | vx_graph | graph, |
vx_uint32 | width, | ||
vx_uint32 | height, | ||
vx_df_image | color | ||
) |
Creates an opaque reference to an image buffer with no direct user access. This function allows setting the image width, height, or format.
Virtual data objects allow users to connect various nodes within a graph via data references without access to that data, but they also permit the implementation to take maximum advantage of possible optimizations. Use this API to create a data reference to link two or more nodes together when the intermediate data are not required to be accessed by outside entities. This API in particular allows the user to define the image format of the data without requiring the exact dimensions. Virtual objects are scoped within the graph they are declared a part of, and can't be shared outside of this scope. All of the following constructions of virtual images are valid.
[in] | graph | The reference to the parent graph. |
[in] | width | The width of the image in pixels. A value of zero informs the interface that the value is unspecified. |
[in] | height | The height of the image in pixels. A value of zero informs the interface that the value is unspecified. |
[in] | color | The VX_DF_IMAGE (vx_df_image_e ) code that represents the format of the image and the color space. A value of VX_DF_IMAGE_VIRT informs the interface that the format is unspecified. |
vx_image
. Any possible errors preventing a successful creation should be checked using vxGetStatus
. vxAccessImagePatch
will return an error. vx_image VX_API_CALL vxCreateImageFromHandle | ( | vx_context | context, |
vx_df_image | color, | ||
vx_imagepatch_addressing_t | addrs[], | ||
void * | ptrs[], | ||
vx_enum | import_type | ||
) |
Creates a reference to an image object that was externally allocated.
[in] | context | The reference to the implementation context. |
[in] | color | See the vx_df_image_e codes. This mandates the number of planes needed to be valid in the addrs and ptrs arrays based on the format given. |
[in] | addrs[] | The array of image patch addressing structures that define the dimension and stride of the array of pointers. |
[in] | ptrs[] | The array of platform-defined references to each plane. |
[in] | import_type | vx_import_type_e . When giving VX_IMPORT_TYPE_HOST the ptrs array is assumed to be HOST accessible pointers to memory. |
vx_image
. Any possible errors preventing a successful creation should be checked using vxGetStatus
. vxCreateImageFromHandle
. Reads or writes to memory referenced by ptrs[ ] after calling vxCreateImageFromHandle
without first calling vxAccessImagePatch
will result in undefined behavior. Retrieves various attributes of an image.
[in] | image | The reference to the image to query. |
[in] | attribute | The attribute to query. Use a vx_image_attribute_e . |
[out] | ptr | The location at which to store the resulting value. |
[in] | size | The size in bytes of the container to which ptr points. |
vx_status_e
enumeration. VX_SUCCESS | No errors. |
VX_ERROR_INVALID_REFERENCE | If the image is not a vx_image . |
VX_ERROR_INVALID_PARAMETERS | If any of the other parameters are incorrect. |
VX_ERROR_NOT_SUPPORTED | If the attribute is not supported on this implementation. |
vx_status VX_API_CALL vxSetImageAttribute | ( | vx_image | image, |
vx_enum | attribute, | ||
const void * | ptr, | ||
vx_size | size | ||
) |
Allows setting attributes on the image.
[in] | image | The reference to the image on which to set the attribute. |
[in] | attribute | The attribute to set. Use a vx_image_attribute_e enumeration. |
[in] | ptr | The pointer to the location from which to read the value. |
[in] | size | The size in bytes of the object pointed to by ptr. |
vx_status_e
enumeration. VX_SUCCESS | No errors. |
VX_ERROR_INVALID_REFERENCE | If the image is not a vx_image . |
VX_ERROR_INVALID_PARAMETERS | If any of the other parameters are incorrect. |
Releases a reference to an image object. The object may not be garbage collected until its total reference count is zero.
[in] | image | The pointer to the image to release. |
vx_status_e
enumeration. VX_SUCCESS | No errors. |
VX_ERROR_INVALID_REFERENCE | If image is not a vx_image . |
vx_size VX_API_CALL vxComputeImagePatchSize | ( | vx_image | image, |
const vx_rectangle_t * | rect, | ||
vx_uint32 | plane_index | ||
) |
This computes the size needed to retrieve an image patch from an image.
[in] | image | The reference to the image from which to extract the patch. |
[in] | rect | The coordinates. Must be 0 <= start < end <= dimension where dimension is width for x and height for y. |
[in] | plane_index | The plane index from which to get the data. |
vx_status VX_API_CALL vxAccessImagePatch | ( | vx_image | image, |
const vx_rectangle_t * | rect, | ||
vx_uint32 | plane_index, | ||
vx_imagepatch_addressing_t * | addr, | ||
void ** | ptr, | ||
vx_enum | usage | ||
) |
Allows the User to extract a rectangular patch (subset) of an image from a single plane.
[in] | image | The reference to the image from which to extract the patch. |
[in] | rect | The coordinates from which to get the patch. Must be 0 <= start < end. |
[in] | plane_index | The plane index from which to get the data. |
[in,out] | addr | A pointer to a structure describing the addressing information of the image patch to accessed.
|
[in,out] | ptr | A pointer to a pointer to a location to store the requested data.
|
[in] | usage | This declares the intended usage of the pointer using the vx_accessor_e enumeration. For uniform images Only VX_READ_ONLY is supported. |
vx_status_e
enumeration. VX_ERROR_OPTIMIZED_AWAY | The reference is a virtual image and cannot be accessed or committed. |
VX_ERROR_INVALID_PARAMETERS | The start, end, plane_index, stride_x, or stride_y pointer is incorrect. |
VX_ERROR_INVALID_REFERENCE | The image reference is not actually an image reference. |
vxComputeImagePatchSize
if users wish to allocate their own memory. vxCommitImagePatch
with same (*ptr) value.vx_status VX_API_CALL vxCommitImagePatch | ( | vx_image | image, |
vx_rectangle_t * | rect, | ||
vx_uint32 | plane_index, | ||
vx_imagepatch_addressing_t * | addr, | ||
const void * | ptr | ||
) |
This allows the User to commit a rectangular patch (subset) of an image from a single plane.
[in] | image | The reference to the image from which to extract the patch. |
[in] | rect | The coordinates to which to set the patch. Must be 0 <= start <= end. This may be 0 or a rectangle of zero area in order to indicate that the commit must only decrement the reference count. |
[in] | plane_index | The plane index to which to set the data. |
[in] | addr | The addressing information for the image patch. |
[in] | ptr | A pointer to a pixel buffer to be committed. If the user previously provided a pointer to this buffer to vxAccessImagePatch , the buffer can be freed or re-used after vxCommitImagePatch completes. If the pointer was returned by vxAccessImagePatch , reads or writes to the location pointed by ptr after vxCommitImagePatch completes will result in undefined behavior. |
vx_status_e
enumeration. VX_ERROR_OPTIMIZED_AWAY | The reference is a virtual image and cannot be accessed or committed. |
VX_ERROR_INVALID_PARAMETERS | The start, end, plane_index, stride_x, or stride_y pointer is incorrect. |
VX_ERROR_INVALID_REFERENCE | The image reference is not actually an image reference. |
vxAccessImagePatch
then implementation-specific behavior may occur. If not, then a copy occurs from the users pointer to the internal data of the object. void* VX_API_CALL vxFormatImagePatchAddress1d | ( | void * | ptr, |
vx_uint32 | index, | ||
const vx_imagepatch_addressing_t * | addr | ||
) |
Accesses a specific indexed pixel in an image patch.
[in] | ptr | The base pointer of the patch as returned from vxAccessImagePatch . |
[in] | index | The 0 based index of the pixel count in the patch. Indexes increase horizontally by 1 then wrap around to the next row. |
[in] | addr | The pointer to the addressing mode information returned from vxAccessImagePatch . |
vxAccessImagePatch
void* VX_API_CALL vxFormatImagePatchAddress2d | ( | void * | ptr, |
vx_uint32 | x, | ||
vx_uint32 | y, | ||
const vx_imagepatch_addressing_t * | addr | ||
) |
Accesses a specific pixel at a 2d coordinate in an image patch.
[in] | ptr | The base pointer of the patch as returned from vxAccessImagePatch . |
[in] | x | The x dimension within the patch. |
[in] | y | The y dimension within the patch. |
[in] | addr | The pointer to the addressing mode information returned from vxAccessImagePatch . |
vxAccessImagePatch
vx_status VX_API_CALL vxGetValidRegionImage | ( | vx_image | image, |
vx_rectangle_t * | rect | ||
) |
Retrieves the valid region of the image as a rectangle.
After the image is allocated but has not been written to this returns the full rectangle of the image so that functions do not have to manage a case for uninitialized data. The image still retains an uninitialized value, but once the image is written to via any means such as vxCommitImagePatch
, the valid region is altered to contain the maximum bounds of the written area.
[in] | image | The image from which to retrieve the valid region. |
[out] | rect | The destination rectangle. |
VX_ERROR_INVALID_REFERENCE | Invalid image. |
VX_ERROR_INVALID_PARAMETERS | Invalid rect. |
VX_SUCCESS | Valid image. |
vxAccessImagePatch
to get the full valid region of the image. Modifications from vxCommitImagePatch
grows the valid region.