The OpenVX Specification
dba1aa3

Implements the Image Resizing Kernel.
This kernel resizes an image from the source to the destination dimensions. The supported interpolation types are currently:
The sample positions used to determine output pixel values are generated by scaling the outside edges of the source image pixels to the outside edges of the destination image pixels. As described in the documentation for vx_interpolation_type_e
, samples are taken at pixel centers. This means that, unless the scale is 1:1, the sample position for the top left destination pixel typically does not fall exactly on the top left source pixel but will be generated by interpolation.
That is, the sample positions corresponding in source and destination are defined by the following equations:
\[ x_{input} = \left((x_{output} + 0.5) * \frac{width_{input}}{width_{output}}\right)  0.5 \]
\[ y_{input} = \left((y_{output} + 0.5) * \frac{height_{input}}{height_{output}}\right)  0.5 \]
\[ x_{output} = \left((x_{input} + 0.5) * \frac{width_{output}}{width_{input}}\right)  0.5 \]
\[ y_{output} = \left((y_{input} + 0.5) * \frac{height_{output}}{height_{input}}\right)  0.5 \]
VX_INTERPOLATION_NEAREST_NEIGHBOR
, the output value is that of the pixel whose centre is closest to the sample point.For VX_INTERPOLATION_BILINEAR
, the output value is formed by a weighted average of the nearest source pixels to the sample point. That is:
\[ x_{lower} = \lfloor x_{input}\rfloor \]
\[ y_{lower} = \lfloor y_{input}\rfloor \]
\[ s = x_{input}  x_{lower} \]
\[ t = y_{input}  y_{lower} \]
\[ output(x_{input},y_{input}) = (1s)(1t) * input(x_{lower},y_{lower}) + s(1t) * input(x_{lower}+1,y_{lower}) \]
\[ + (1s)t * input(x_{lower},y_{lower}+1) + s * t * input(x_{lower}+1,y_{lower}+1) \]
For VX_INTERPOLATION_AREA
, the implementation is expected to generate each output pixel by sampling all the source pixels that are at least partly covered by the area bounded by:
\[ \left(x_{output} * \frac{width_{input}}{width_{output}}\right)0.5, \left(y_{output} * \frac{height_{input}}{height_{output}}\right)0.5 \]
and
\[ \left((x_{output} + 1) * \frac{width_{input}}{width_{output}}\right)0.5, \left((y_{output} + 1) * \frac{height_{input}}{height_{output}}\right)0.5 \]
The details of this sampling method are implementationdefined. The implementation should perform enough sampling to avoid aliasing, but there is no requirement that the sample areas for adjacent output pixels be disjoint, nor that the pixels be weighted evenly.
The above diagram shows three sampling methods used to shrink a 7x3 image to 3x1.
The topmost image pair shows nearestneighbor sampling, with crosses on the left image marking the sample positions in the source that are used to generate the output image on the right. As the pixel centre closest to the sample position is white in all cases, the resulting 3x1 image is white.
The middle image pair shows bilinear sampling, with black squares on the left image showing the region in the source being sampled to generate each pixel on the destination image on the right. This sample area is always the size of an input pixel. The outer destination pixels partly sample from the outermost green pixels, so their resulting value is a weighted average of white and green.
The bottom image pair shows area sampling. The black rectangles in the source image on the left show the bounds of the projection of the destination pixels onto the source. The destination pixels on the right are formed by averaging at least those source pixels whose areas are wholly or partly contained within those rectangles. The manner of this averaging is implementationdefined; the example shown here weights the contribution of each source pixel by the amount of that pixel's area contained within the black rectangle.
Functions  
vx_node VX_API_CALL  vxHalfScaleGaussianNode (vx_graph graph, vx_image input, vx_image output, vx_int32 kernel_size) 
[Graph] Performs a Gaussian Blur on an image then halfscales it. The interpolation mode used is nearestneighbor. More...  
vx_node VX_API_CALL  vxScaleImageNode (vx_graph graph, vx_image src, vx_image dst, vx_enum type) 
[Graph] Creates a Scale Image Node. More...  
vx_status VX_API_CALL  vxuHalfScaleGaussian (vx_context context, vx_image input, vx_image output, vx_int32 kernel_size) 
[Immediate] Performs a Gaussian Blur on an image then halfscales it. The interpolation mode used is nearestneighbor. More...  
vx_status VX_API_CALL  vxuScaleImage (vx_context context, vx_image src, vx_image dst, vx_enum type) 
[Immediate] Scales an input image to an output image. More...  
[Graph] Creates a Scale Image Node.
[in]  graph  The reference to the graph. 
[in]  src  The source image of type VX_DF_IMAGE_U8 . 
[out]  dst  The destination image of type VX_DF_IMAGE_U8 . 
[in]  type  The interpolation type to use. 
VX_NODE_BORDER
value VX_BORDER_UNDEFINED
, VX_BORDER_REPLICATE
and VX_BORDER_CONSTANT
are supported. vx_node
. vx_node  A node reference. Any possible errors preventing a successful creation should be checked using vxGetStatus 
vx_node VX_API_CALL vxHalfScaleGaussianNode  (  vx_graph  graph, 
vx_image  input,  
vx_image  output,  
vx_int32  kernel_size  
) 
[Graph] Performs a Gaussian Blur on an image then halfscales it. The interpolation mode used is nearestneighbor.
The output image size is determined by:
\[ W_{output} = \frac{W_{input} + 1}{2} \\ , H_{output} = \frac{H_{input} + 1}{2} \]
[in]  graph  The reference to the graph. 
[in]  input  The input VX_DF_IMAGE_U8 image. 
[out]  output  The output VX_DF_IMAGE_U8 image. 
[in]  kernel_size  The input size of the Gaussian filter. Supported values are 1, 3 and 5. 
vx_node
. vx_node  A node reference. Any possible errors preventing a successful creation should be checked using vxGetStatus 
vx_status VX_API_CALL vxuScaleImage  (  vx_context  context, 
vx_image  src,  
vx_image  dst,  
vx_enum  type  
) 
[Immediate] Scales an input image to an output image.
[in]  context  The reference to the overall context. 
[in]  src  The source image of type VX_DF_IMAGE_U8 . 
[out]  dst  The destintation image of type VX_DF_IMAGE_U8 . 
[in]  type  The interpolation type. 
vx_status_e
enumeration. VX_SUCCESS  Success 
*  An error occurred. See vx_status_e . 
vx_status VX_API_CALL vxuHalfScaleGaussian  (  vx_context  context, 
vx_image  input,  
vx_image  output,  
vx_int32  kernel_size  
) 
[Immediate] Performs a Gaussian Blur on an image then halfscales it. The interpolation mode used is nearestneighbor.
[in]  context  The reference to the overall context. 
[in]  input  The input VX_DF_IMAGE_U8 image. 
[out]  output  The output VX_DF_IMAGE_U8 image. 
[in]  kernel_size  The input size of the Gaussian filter. Supported values are 1, 3 and 5. 
vx_status_e
enumeration. VX_SUCCESS  Success 
*  An error occurred. See vx_status_e . 