The OpenVX Specification  r28647
 All Data Structures Functions Variables Typedefs Enumerations Enumerator Groups Pages
Object: Kernel

Detailed Description

Defines the Kernel Object and Interface.

A Kernel in OpenVX is the abstract representation of an computer vision function, such as a “Sobel Gradient” or “Lucas Kanade Feature Tracking”. A vision function may implement many similar or identical features from other functions, but it is still considered a single unique kernel as long as it is named by the same string and enumeration and conforms to the results specified by OpenVX. Kernels are similar to function signatures in this regard.

In each of the cases, a client of OpenVX could request the kernels in nearly the same manner. There are two main approaches, which depend on the method a client calls to get the kernel reference. The first uses enumerations.

vx_node node = vxCreateGenericNode(graph, kernel);

The second method depends on using strings to get the kernel reference.

vx_kernel kernel = vxGetKernelByName(context, "org.khronos.openvx.sobel3x3");
vx_node node = vxCreateGenericNode(graph, kernel);

Data Structures

struct  vx_kernel_info_t
 The Kernel Information Structure. This is returned by the Context to indicate which kernels are available in the OpenVX implementation. More...
 

Macros

#define VX_MAX_KERNEL_NAME   (256)
 Defines the maximum string length of a kernel name to be added to OpenVX.
 

Typedefs

typedef struct _vx_kernel * vx_kernel
 An opaque reference to the descriptor of a kernel. More...
 

Enumerations

enum  vx_kernel_attribute_e {
  VX_KERNEL_ATTRIBUTE_PARAMETERS = ((( VX_ID_KHRONOS ) << 20) | ( VX_TYPE_KERNEL << 8)) + 0x0,
  VX_KERNEL_ATTRIBUTE_NAME = ((( VX_ID_KHRONOS ) << 20) | ( VX_TYPE_KERNEL << 8)) + 0x1,
  VX_KERNEL_ATTRIBUTE_ENUM = ((( VX_ID_KHRONOS ) << 20) | ( VX_TYPE_KERNEL << 8)) + 0x2,
  VX_KERNEL_ATTRIBUTE_LOCAL_DATA_SIZE = ((( VX_ID_KHRONOS ) << 20) | ( VX_TYPE_KERNEL << 8)) + 0x3,
  VX_KERNEL_ATTRIBUTE_LOCAL_DATA_PTR = ((( VX_ID_KHRONOS ) << 20) | ( VX_TYPE_KERNEL << 8)) + 0x4
}
 The kernel attributes list. More...
 
enum  vx_kernel_e {
  VX_KERNEL_INVALID = VX_KERNEL_BASE(VX_ID_KHRONOS, VX_LIBRARY_KHR_BASE) + 0x0,
  VX_KERNEL_COLOR_CONVERT = VX_KERNEL_BASE(VX_ID_KHRONOS, VX_LIBRARY_KHR_BASE) + 0x1,
  VX_KERNEL_CHANNEL_EXTRACT = VX_KERNEL_BASE(VX_ID_KHRONOS, VX_LIBRARY_KHR_BASE) + 0x2,
  VX_KERNEL_CHANNEL_COMBINE = VX_KERNEL_BASE(VX_ID_KHRONOS, VX_LIBRARY_KHR_BASE) + 0x3,
  VX_KERNEL_SOBEL_3x3 = VX_KERNEL_BASE(VX_ID_KHRONOS, VX_LIBRARY_KHR_BASE) + 0x4,
  VX_KERNEL_MAGNITUDE = VX_KERNEL_BASE(VX_ID_KHRONOS, VX_LIBRARY_KHR_BASE) + 0x5,
  VX_KERNEL_PHASE = VX_KERNEL_BASE(VX_ID_KHRONOS, VX_LIBRARY_KHR_BASE) + 0x6,
  VX_KERNEL_SCALE_IMAGE = VX_KERNEL_BASE(VX_ID_KHRONOS, VX_LIBRARY_KHR_BASE) + 0x7,
  VX_KERNEL_TABLE_LOOKUP = VX_KERNEL_BASE(VX_ID_KHRONOS, VX_LIBRARY_KHR_BASE) + 0x8,
  VX_KERNEL_HISTOGRAM = VX_KERNEL_BASE(VX_ID_KHRONOS, VX_LIBRARY_KHR_BASE) + 0x9,
  VX_KERNEL_EQUALIZE_HISTOGRAM = VX_KERNEL_BASE(VX_ID_KHRONOS, VX_LIBRARY_KHR_BASE) + 0xA,
  VX_KERNEL_ABSDIFF = VX_KERNEL_BASE(VX_ID_KHRONOS, VX_LIBRARY_KHR_BASE) + 0xB,
  VX_KERNEL_MEAN_STDDEV = VX_KERNEL_BASE(VX_ID_KHRONOS, VX_LIBRARY_KHR_BASE) + 0xC,
  VX_KERNEL_THRESHOLD = VX_KERNEL_BASE(VX_ID_KHRONOS, VX_LIBRARY_KHR_BASE) + 0xD,
  VX_KERNEL_INTEGRAL_IMAGE = VX_KERNEL_BASE(VX_ID_KHRONOS, VX_LIBRARY_KHR_BASE) + 0xE,
  VX_KERNEL_DILATE_3x3 = VX_KERNEL_BASE(VX_ID_KHRONOS, VX_LIBRARY_KHR_BASE) + 0xF,
  VX_KERNEL_ERODE_3x3 = VX_KERNEL_BASE(VX_ID_KHRONOS, VX_LIBRARY_KHR_BASE) + 0x10,
  VX_KERNEL_MEDIAN_3x3 = VX_KERNEL_BASE(VX_ID_KHRONOS, VX_LIBRARY_KHR_BASE) + 0x11,
  VX_KERNEL_BOX_3x3 = VX_KERNEL_BASE(VX_ID_KHRONOS, VX_LIBRARY_KHR_BASE) + 0x12,
  VX_KERNEL_GAUSSIAN_3x3 = VX_KERNEL_BASE(VX_ID_KHRONOS, VX_LIBRARY_KHR_BASE) + 0x13,
  VX_KERNEL_CUSTOM_CONVOLUTION = VX_KERNEL_BASE(VX_ID_KHRONOS, VX_LIBRARY_KHR_BASE) + 0x14,
  VX_KERNEL_GAUSSIAN_PYRAMID = VX_KERNEL_BASE(VX_ID_KHRONOS, VX_LIBRARY_KHR_BASE) + 0x15,
  VX_KERNEL_ACCUMULATE = VX_KERNEL_BASE(VX_ID_KHRONOS, VX_LIBRARY_KHR_BASE) + 0x16,
  VX_KERNEL_ACCUMULATE_WEIGHTED = VX_KERNEL_BASE(VX_ID_KHRONOS, VX_LIBRARY_KHR_BASE) + 0x17,
  VX_KERNEL_ACCUMULATE_SQUARE = VX_KERNEL_BASE(VX_ID_KHRONOS, VX_LIBRARY_KHR_BASE) + 0x18,
  VX_KERNEL_MINMAXLOC = VX_KERNEL_BASE(VX_ID_KHRONOS, VX_LIBRARY_KHR_BASE) + 0x19,
  VX_KERNEL_CONVERTDEPTH = VX_KERNEL_BASE(VX_ID_KHRONOS, VX_LIBRARY_KHR_BASE) + 0x1A,
  VX_KERNEL_CANNY_EDGE_DETECTOR = VX_KERNEL_BASE(VX_ID_KHRONOS, VX_LIBRARY_KHR_BASE) + 0x1B,
  VX_KERNEL_AND = VX_KERNEL_BASE(VX_ID_KHRONOS, VX_LIBRARY_KHR_BASE) + 0x1C,
  VX_KERNEL_OR = VX_KERNEL_BASE(VX_ID_KHRONOS, VX_LIBRARY_KHR_BASE) + 0x1D,
  VX_KERNEL_XOR = VX_KERNEL_BASE(VX_ID_KHRONOS, VX_LIBRARY_KHR_BASE) + 0x1E,
  VX_KERNEL_NOT = VX_KERNEL_BASE(VX_ID_KHRONOS, VX_LIBRARY_KHR_BASE) + 0x1F,
  VX_KERNEL_MULTIPLY = VX_KERNEL_BASE(VX_ID_KHRONOS, VX_LIBRARY_KHR_BASE) + 0x20,
  VX_KERNEL_ADD = VX_KERNEL_BASE(VX_ID_KHRONOS, VX_LIBRARY_KHR_BASE) + 0x21,
  VX_KERNEL_SUBTRACT = VX_KERNEL_BASE(VX_ID_KHRONOS, VX_LIBRARY_KHR_BASE) + 0x22,
  VX_KERNEL_WARP_AFFINE = VX_KERNEL_BASE(VX_ID_KHRONOS, VX_LIBRARY_KHR_BASE) + 0x23,
  VX_KERNEL_WARP_PERSPECTIVE = VX_KERNEL_BASE(VX_ID_KHRONOS, VX_LIBRARY_KHR_BASE) + 0x24,
  VX_KERNEL_HARRIS_CORNERS = VX_KERNEL_BASE(VX_ID_KHRONOS, VX_LIBRARY_KHR_BASE) + 0x25,
  VX_KERNEL_FAST_CORNERS = VX_KERNEL_BASE(VX_ID_KHRONOS, VX_LIBRARY_KHR_BASE) + 0x26,
  VX_KERNEL_OPTICAL_FLOW_PYR_LK = VX_KERNEL_BASE(VX_ID_KHRONOS, VX_LIBRARY_KHR_BASE) + 0x27,
  VX_KERNEL_REMAP = VX_KERNEL_BASE(VX_ID_KHRONOS, VX_LIBRARY_KHR_BASE) + 0x28,
  VX_KERNEL_HALFSCALE_GAUSSIAN = VX_KERNEL_BASE(VX_ID_KHRONOS, VX_LIBRARY_KHR_BASE) + 0x29,
  VX_KERNEL_MAX_1_0
}
 The standard list of available vision kernels. More...
 

Functions

vx_kernel vxGetKernelByEnum (vx_context context, vx_enum kernel)
 Obtains a reference to the kernel using the vx_kernel_e enumeration. More...
 
vx_kernel vxGetKernelByName (vx_context context, vx_char *name)
 Obtains a reference to a kernel using a string to specify the name. More...
 
vx_status vxQueryKernel (vx_kernel kernel, vx_enum attribute, void *ptr, vx_size size)
 This allows the client to query the kernel to get information about the number of parameters, enum values, etc. More...
 
vx_status vxReleaseKernel (vx_kernel *kernel)
 Release the reference to the kernel. The object may not be garbage collected until its total reference count is zero. More...
 

Data Structure Documentation

struct vx_kernel_info_t

The Kernel Information Structure. This is returned by the Context to indicate which kernels are available in the OpenVX implementation.

Definition at line 1311 of file vx_types.h.

Data Fields
vx_enum enumeration The kernel enumeration value from vx_kernel_e (or an extension thereof).
See also
vxGetKernelByEnum
vx_char name[VX_MAX_KERNEL_NAME] The kernel name in dotted hierarchical format. e.g. "org.khronos.openvx.sobel3x3".
See also
vxGetKernelByName

Typedef Documentation

typedef struct _vx_kernel* vx_kernel

An opaque reference to the descriptor of a kernel.

See also
vxGetKernelByName
vxGetKernelByEnum

Definition at line 152 of file vx_types.h.

Enumeration Type Documentation

The standard list of available vision kernels.

Each kernel listed here can be used with the vxGetKernelByEnum call. When programming the parameters, use

When programming the parameters, use

Enumerator
VX_KERNEL_INVALID 

The invalid kernel is used to for conformance failure in relation to some kernel operation (Get/Release).

If the kernel is executed it shall always return an error. The kernel has no parameters. To address by name use "org.khronos.openvx.invalid".

VX_KERNEL_COLOR_CONVERT 

The Color Space conversion kernel.

The conversions are based on the vx_df_image_e code in the images.

See also
Color Convert
VX_KERNEL_CHANNEL_EXTRACT 

The Generic Channel Extraction Kernel.

This kernel can remove individual color channels from an interleaved or semi-planar, planar, sub-sampled planar image. A client could extract a red channel from an interleaved RGB image or do a Luma extract from a YUV format.

See also
Channel Extract
VX_KERNEL_CHANNEL_COMBINE 

The Generic Channel Combine Kernel.

This kernel combine multiple individual planes into a single multiplanar image of the type specified in the output image.

See also
Channel Combine
VX_KERNEL_SOBEL_3x3 

The Sobel 3x3 Filter Kernel.

See also
Sobel 3x3
VX_KERNEL_MAGNITUDE 

The Magnitude Kernel.

This kernel produces a magnitude plane from two input gradients.

See also
Magnitude
VX_KERNEL_PHASE 

The Phase Kernel.

This kernel produces a phase plane from two input gradients.

See also
Phase
VX_KERNEL_SCALE_IMAGE 

The Scale Image Kernel.

This kernel provides resizing of an input image to an output image. The scaling factor is determined but the relative sizes of the input and output.

See also
Scale Image
VX_KERNEL_TABLE_LOOKUP 

The Table Lookup kernel.

See also
TableLookup
VX_KERNEL_HISTOGRAM 

The Histogram Kernel.

See also
Histogram
VX_KERNEL_EQUALIZE_HISTOGRAM 

The Histogram Equalization Kernel.

See also
Equalize Histogram
VX_KERNEL_ABSDIFF 

The Absolute Difference Kernel.

See also
Absolute Difference
VX_KERNEL_MEAN_STDDEV 

The Mean and Standard Deviation Kernel.

See also
Mean and Standard Deviation
VX_KERNEL_THRESHOLD 

The Threshold Kernel.

See also
Thresholding
VX_KERNEL_INTEGRAL_IMAGE 

The Integral Image Kernel.

See also
Integral Image
VX_KERNEL_DILATE_3x3 

The dilate kernel.

See also
Dilate Image
VX_KERNEL_ERODE_3x3 

The erode kernel.

See also
Dilate Image
VX_KERNEL_MEDIAN_3x3 

The median image filter.

See also
Median Filter
VX_KERNEL_BOX_3x3 

The box filter kernel.

See also
Box Filter
VX_KERNEL_GAUSSIAN_3x3 

The gaussian filter kernel.

See also
Gaussian Filter
VX_KERNEL_CUSTOM_CONVOLUTION 

The custom convolution kernel.

See also
Custom Convolution
VX_KERNEL_GAUSSIAN_PYRAMID 

The gaussian image pyramid kernel.

See also
Gaussian Image Pyramid
VX_KERNEL_ACCUMULATE 

The accumulation kernel.

See also
Accumulate
VX_KERNEL_ACCUMULATE_WEIGHTED 

The weigthed accumulation kernel.

See also
Accumulate Weighted
VX_KERNEL_ACCUMULATE_SQUARE 

The squared accumulation kernel.

See also
Accumulate Squared
VX_KERNEL_MINMAXLOC 

The min and max location kernel.

See also
Min, Max Location
VX_KERNEL_CONVERTDEPTH 

The bit-depth conversion kernel.

See also
Convert Bit depth
VX_KERNEL_CANNY_EDGE_DETECTOR 

The Canny Edge Detector.

See also
Canny Edge Detector
VX_KERNEL_AND 

The Bitwise And Kernel.

See also
Bitwise AND
VX_KERNEL_OR 

The Bitwise Inclusive Or Kernel.

See also
Bitwise INCLUSIVE OR
VX_KERNEL_XOR 

The Bitwise Exclusive Or Kernel.

See also
Bitwise EXCLUSIVE OR
VX_KERNEL_NOT 

The Bitwise Not Kernel.

See also
Bitwise NOT
VX_KERNEL_MULTIPLY 

The Pixelwise Multiplication Kernel.

See also
Pixel-wise Multiplication
VX_KERNEL_ADD 

The Addition Kernel.

See also
Arithmetic Addition
VX_KERNEL_SUBTRACT 

The Subtraction Kernel.

See also
Arithmetic Subtraction
VX_KERNEL_WARP_AFFINE 

The Warp Affine Kernel.

See also
Warp Affine
VX_KERNEL_WARP_PERSPECTIVE 

The Warp Perspective Kernel.

See also
Warp Perspective
VX_KERNEL_HARRIS_CORNERS 

The Harris Corners Kernel.

See also
Harris Corners
VX_KERNEL_FAST_CORNERS 

The FAST Corners Kernel.

See also
Fast Corners
VX_KERNEL_OPTICAL_FLOW_PYR_LK 

The Optical Flow Pyramid (LK) Kernel.

See also
Optical Flow Pyramid (LK)
VX_KERNEL_REMAP 

The Remap Kernel.

See also
Remap
VX_KERNEL_HALFSCALE_GAUSSIAN 

The Half Scale Gaussian Kernel.

See also
Scale Image

Definition at line 56 of file vx_kernels.h.

The kernel attributes list.

Enumerator
VX_KERNEL_ATTRIBUTE_PARAMETERS 

Queries a kernel for the number of parameters the kernel supports. Use a vx_uint32 parameter.

VX_KERNEL_ATTRIBUTE_NAME 

Queries the name of the kernel. Not settable. Use a vx_char[VX_MAX_KERNEL_NAME] array (not a vx_array).

VX_KERNEL_ATTRIBUTE_ENUM 

Queries the enum of the kernel. Not settable. Use a vx_enum parameter.

VX_KERNEL_ATTRIBUTE_LOCAL_DATA_SIZE 

The local data area allocated with each kernel when it becomes a node. Use a vx_size parameter.

Note
If not set it will default to zero.
VX_KERNEL_ATTRIBUTE_LOCAL_DATA_PTR 

The local data pointer allocated with each kernel when it becomes a node. Use a void pointer parameter. Use a vx_size parameter.

Definition at line 700 of file vx_types.h.

Function Documentation

vx_kernel vxGetKernelByName ( vx_context  context,
vx_char name 
)

Obtains a reference to a kernel using a string to specify the name.

Parameters
[in]contextThe reference to the implementation context.
[in]nameThe string of the name of the kernel to get.
Returns
A kernel reference or zero if an error occurred.
Return values
0The kernel name is not found in the context.
Precondition
vxLoadKernels if the kernel is not provided by the OpenVX implementation.
Note
User Kernels should follow a "dotted" heirarchical syntax. For example: "com.company.example.xyz".
vx_kernel vxGetKernelByEnum ( vx_context  context,
vx_enum  kernel 
)

Obtains a reference to the kernel using the vx_kernel_e enumeration.

Enum values above the standard set are assumed to apply to loaded libraries.

Parameters
[in]contextThe reference to the implementation context.
[in]kernelA value from vx_kernel_e or a vendor or client-defined value.
Returns
A vx_kernel.
Return values
0The kernel enumeration is not found in the context.
Precondition
vxLoadKernels if the kernel is not provided by the OpenVX implementation.
vx_status vxQueryKernel ( vx_kernel  kernel,
vx_enum  attribute,
void *  ptr,
vx_size  size 
)

This allows the client to query the kernel to get information about the number of parameters, enum values, etc.

Parameters
[in]kernelThe kernel reference to query.
[in]attributeThe attribute to query. Use a vx_kernel_attribute_e.
[out]ptrThe pointer to the location at which to store the resulting value.
[in]sizeThe size of the container to which ptr points.
Returns
A vx_status_e enumeration.
Return values
VX_SUCCESSNo errors.
VX_ERROR_INVALID_REFERENCEIf the kernel is not a vx_kernel.
VX_ERROR_INVALID_PARAMETERSIf any of the other parameters are incorrect.
VX_ERROR_NOT_SUPPORTEDIf the attribute value is not supported in this implementation.
vx_status vxReleaseKernel ( vx_kernel kernel)

Release the reference to the kernel. The object may not be garbage collected until its total reference count is zero.

Parameters
[in]kernelThe pointer to the kernel reference to release.
Postcondition
After returning from this function the reference is zeroed.
Returns
A vx_status_e enumeration.
Return values
VX_SUCCESSNo errors.
VX_ERROR_INVALID_REFERENCEIf graph is not a vx_graph.