• 04/03/2020
  • Public Content

Example of OpenCV Processing of the OpenVX* Image

Often, the standard OpenVX* kernels and extensions are not enough for implementing particular computer vision pipeline. Similarly the
can be accessed with OpenCV, using the same
functions (see the Example Interoperability with OpenCV section).
void callOpenCVGaussianBlur(vx_image input, vx_image output) { vx_uint32 width = 0, height = 0; vxQueryImage(input, VX_IMAGE_WIDTH, &width, sizeof(width)); vxQueryImage(input, VX_IMAGE_HEIGHT, &height, sizeof(height)); vx_rectangle_t rect = { 0u, 0u, width, height }; vx_imagepatch_addressing_t input_addr = {}; void *input_ptr = nullptr; vx_map_id map_id_in; vxMapImagePatch(input, &rect, 0, &map_id_in, &input_addr, &input_ptr, VX_READ_ONLY); vx_imagepatch_addressing_t output_addr = {}; void *output_ptr = nullptr; vx_map_id map_id_out; vxMapImagePatch(output, &rect, 0, & map_id_out , &output_addr, &output_ptr, VX_WRITE_ONLY); cv::Mat mat_input(input_addr.dim_y * VX_SCALE_UNITY / input_addr.scale_y, input_addr.dim_x * VX_SCALE_UNITY / input_addr.scale_x, CV_8UC1, input_ptr, input_addr.stride_y); cv::Mat mat_output(output_addr.dim_y * VX_SCALE_UNITY / output_addr.scale_y, output_addr.dim_x * VX_SCALE_UNITY / output_addr.scale_x, CV_8UC1, output_ptr, output_addr.stride_y); cv::GaussianBlur(mat_input, mat_output, cv::Size(5, 5), 1.5); vxUnmapImagePatch(input, map_id_in); }
Also, you can make the function above fully pluggable to OpenVX graphs. Specifically, the OpenVX* supports user-defined functions that are executed as nodes from inside the graph. As detailed in multiple examples (see the OpenVX Sample Applications chapter) in order to define a user kernel, you just need to implement several call-back functions in addition to the execution routine itself.

Product and Performance Information


Intel's compilers may or may not optimize to the same degree for non-Intel microprocessors for optimizations that are not unique to Intel microprocessors. These optimizations include SSE2, SSE3, and SSSE3 instruction sets and other optimizations. Intel does not guarantee the availability, functionality, or effectiveness of any optimization on microprocessors not manufactured by Intel. Microprocessor-dependent optimizations in this product are intended for use with Intel microprocessors. Certain optimizations not specific to Intel microarchitecture are reserved for Intel microprocessors. Please refer to the applicable product User and Reference Guides for more information regarding the specific instruction sets covered by this notice.

Notice revision #20110804