OpenVX XML Schema Extension  r29754
 All Functions Typedefs Enumerations Enumerator Groups Pages
XML Description

The XML Schema provides the necessary specification required to validate a OpenVX conformant XML file, but it alone is not sufficient to ensure full compatibility with OpenVX compliant implementations. Therefore, this section is intended supplement the schema by providing more details and examples of a conformant xml document.

The rest of this section will discuss each xml element in more detail. The examples contained in this section are a sample of a larger example xml file which is included in section XML Example

Each element described in this section will also reference the schema type name in order to help cross-reference the schema. For all elements which can be references, an optional "name" field can be used so that the import program can reference a reference by name.

OpenVX Element

Schema type: openvx.type

The 'openvx' tag encapsulates the entire OpenVX element. The 'references' attribute informs the parser as to the the number of OpenVX references that are contained in the xml file. Each data and graph object that corresponds to an OpenVX object will have a unique reference number in the xml file. The range of valid reference numbers should be between 0 and ["references"-1]. These references may appear in any order. Below is an example of the openvx element which indicates that the xml file has 124 objects enumerated.

<openvx xmlns:xsi=""
xsi:schemaLocation=" openvx-1-0.xsd"

OpenVX Graph Objects

Schema type: graph.type

Graph elements each have their own reference number (and optional name), and may have child elements consisting of nodes, graph parameters, and virtual objects associated with the graph. The following example can be used as a reference for the discussion on graph objects.

<graph reference="40" name="GRAPH1" >
<node reference="52">
<parameter index="0" reference="0" />
<parameter index="1" reference="41" />
<parameter index="2" reference="42" />
<node reference="54">
<parameter index="0" reference="41" />
<parameter index="1" reference="1" />
<parameter index="2" reference="53" />
<parameter index="3" reference="51" />
<parameter index="0" node="52" parameter="0" />
<parameter index="1" node="54" parameter="1" />
<image reference="41" width="0" height="0" format="VIRT" />
<image reference="42" width="0" height="0" format="S016" />
<image reference="43" width="320" height="240" format="VIRT" />
<image reference="44" width="640" height="480" format="U008" />
<pyramid reference="45" width="0" height="0" format="VIRT" scale="0.500000" levels="4" />
<pyramid reference="46" width="640" height="480" format="VIRT" scale="0.500000" levels="4" />
<pyramid reference="47" width="640" height="480" format="U008" scale="0.500000" levels="4" />
<array reference="48" capacity="0" elemType="VX_TYPE_INVALID" />
<array reference="49" capacity="0" elemType="VX_TYPE_KEYPOINT" />
<array reference="50" capacity="1000" elemType="VX_TYPE_KEYPOINT" />


Schema type: node.type

Each node element of the graph has its own reference number (and optional name) and one child element specifying the kernel name. Each node element contains "n" number of parameter child elements, where "n" is equal to the number of parameters corresponding to the kernel specified. The index attribute of each parameter should monotonically increment. The reference attribute associated with each parameter should correspond to the reference number of the data object which is enumerated either as a virtual object reference within the graph, or elsewhere in the xml document.

Graph Parameters

Schema type: graph.parameter.type

Graph parameters do not have a reference number. The index attribute of each parameter should monotonically increment. The graph parameter identifies which parameter of which node is being exported as a graph parameter at the corresponding index.

Virtual Data Objects

Schema type: virtual.image.type, virtual.array.type, virtual.pyramid.type

Typically, data objects are enumerated outside of the graph element. However, virtual data objects (such as virtual arrays, virtual images, and virtual pyramids) are always listed as child elements of the graph element that they are associated with. Since virtual objects may not have accessible memory to the user, the xml does not specify the data of virtual objects. The format of the virtual data objects will be discussed further in OpenVX Data Objects.

OpenVX Data Objects

Each of the data objects specified in OpenVX can be represented in xml representation. For each data object, the minimum information required to create the data object in a context is required. Optionally, the actual data included in the data object may also be represented in child elements of the object element in the xml. This way, during xml import into a context, the import utility should create all listed data objects, and if data is also specified for any data objects, then this data should be initialized within the imported data object. During xml export, if a data object has been created but not yet written to, then it may not be necessary to export the uninitialized data into the xml file for the associated data object.

Since virtual objects (virtual arrays, virtual images, or virtual pyramids) may not have accessible memory to the user, the xml does not specify the data of virtual objects.


Schema type: array.type

Each array element below is a valid example of a virtual arrays within a graph element:

<array reference="48" capacity="0" elemType="VX_TYPE_INVALID" />
<array reference="49" capacity="0" elemType="VX_TYPE_KEYPOINT" />
<array reference="50" capacity="1000" elemType="VX_TYPE_KEYPOINT" />

Each array element is a valid example of array objects. Please refer to the schema under array.type for all supported data types and formats of arrays:

<array reference="96" capacity="10" elemType="VX_TYPE_UINT8">
<uint8>2 3 4 5 6 7 8 9 10 11 </uint8>
<array reference="97" capacity="20" elemType="VX_TYPE_CHAR">
<char>a 13,.;^-</char>
<array reference="98" capacity="4" elemType="VX_TYPE_ENUM">
<enum>-1 0 45057 </enum>
<array reference="99" capacity="4" elemType="VX_TYPE_DF_IMAGE">
<df_image>RGB2 U008 VIRT </df_image>
<array reference="100" capacity="3" elemType="VX_TYPE_KEYPOINT">
<array reference="101" capacity="5" elemType="VX_TYPE_RECTANGLE">
<array reference="102" capacity="6" elemType="VX_TYPE_COORDINATES2D">
<array reference="103" capacity="6" elemType="VX_TYPE_COORDINATES3D">
<array reference="104" capacity="8" elemType="VX_TYPE_INT8">
<int8>5 0 -3 -8 </int8>
<array reference="105" capacity="6" elemType="VX_TYPE_INT16">
<int16>200 100 0 -100 -200 </int16>
<array reference="106" capacity="6" elemType="VX_TYPE_INT32">
<int32>200000 100000 0 -100000 -200000 </int32>
<array reference="107" capacity="3" elemType="VX_TYPE_BOOL">
<bool>true false true </bool>
<array reference="108" capacity="4" elemType="VX_TYPE_SIZE">
<size>8000 24000 </size>
<array reference="109" capacity="2" elemType="VX_TYPE_FLOAT64">
<float64>1235.255660 -563.256700 </float64>
<array reference="110" capacity="8" elemType="VX_TYPE_UINT64">
<uint64>9000000000 8000000000 7000000000 6000000000 </uint64>
<array reference="111" capacity="6" elemType="VX_TYPE_UINT16">
<uint16>290 100 0 100 260 </uint16>
<array reference="112" capacity="6" elemType="VX_TYPE_UINT32">
<uint32>200000 100000 0 100000 200000 </uint32>
<array reference="113" capacity="2" elemType="VX_TYPE_FLOAT32">
<float32>1235.255615 -563.256714 </float32>
<array reference="114" capacity="8" elemType="VX_TYPE_INT64">
<int64>9000000000 8000000000 -7000000000 -6000000000 </int64>
<array reference="120" capacity="4" elemType="USER_STRUCT_0">
<user>32 0 0 0 158 127 0 0 154 153 153 153 153 153 9 64 </user>
<user>64 0 0 0 158 127 0 0 154 153 153 153 153 153 25 64 </user>


Schema type: convolution.type

Below is a valid example of a convolution object:

<convolution reference="31" rows="3" columns="3" scale="16">
<int16 row="0" column="0">-1</int16>
<int16 row="0" column="1">0</int16>
<int16 row="0" column="2">1</int16>
<int16 row="1" column="0">-2</int16>
<int16 row="1" column="1">0</int16>
<int16 row="1" column="2">1</int16>
<int16 row="2" column="0">-1</int16>
<int16 row="2" column="1">0</int16>
<int16 row="2" column="2">1</int16>


Schema type: delay.type

Delay onject types can be one of many of the other data types. For list of supported delay types, please refer to the schema under delay.type. Below is a valid example of a delay object:

<delay reference="55" count="3">
<image reference="56" width="6" height="4" format="U008">
<image reference="57" width="6" height="4" format="U008">
<image reference="58" width="6" height="4" format="U008">


Schema type: distribution.type

Below is a valid example of a distribution object:

<distribution reference="34" bins="16" offset="0" range="256">
<frequency bin="0">0</frequency>
<frequency bin="1">1</frequency>
<frequency bin="2">2</frequency>
<frequency bin="3">3</frequency>
<frequency bin="4">4</frequency>
<frequency bin="5">5</frequency>
<frequency bin="6">6</frequency>
<frequency bin="7">7</frequency>
<frequency bin="8">8</frequency>
<frequency bin="9">7</frequency>
<frequency bin="10">6</frequency>
<frequency bin="11">5</frequency>
<frequency bin="12">4</frequency>
<frequency bin="13">3</frequency>
<frequency bin="14">2</frequency>
<frequency bin="15">1</frequency>


Schema type: image.type

Below are valid examples of image objects:

<image reference="0" width="6" height="4" format="U008">
<rectangle plane="0">
<uint8 x="0" y="0">0</uint8>
<uint8 x="1" y="0">1</uint8>
<uint8 x="2" y="0">2</uint8>
<uint8 x="3" y="0">3</uint8>
<uint8 x="4" y="0">4</uint8>
<uint8 x="5" y="0">5</uint8>
<uint8 x="0" y="1">6</uint8>
<uint8 x="1" y="1">7</uint8>
<uint8 x="2" y="1">8</uint8>
<uint8 x="3" y="1">9</uint8>
<uint8 x="4" y="1">10</uint8>
<uint8 x="5" y="1">11</uint8>
<uint8 x="0" y="2">12</uint8>
<uint8 x="1" y="2">13</uint8>
<uint8 x="2" y="2">14</uint8>
<uint8 x="3" y="2">15</uint8>
<uint8 x="4" y="2">16</uint8>
<uint8 x="5" y="2">17</uint8>
<uint8 x="0" y="3">18</uint8>
<uint8 x="1" y="3">19</uint8>
<uint8 x="2" y="3">20</uint8>
<uint8 x="3" y="3">21</uint8>
<uint8 x="4" y="3">22</uint8>
<uint8 x="5" y="3">23</uint8>
<image reference="1" width="6" height="4" format="U008">


Schema type: lut.type

Below is a valid example of a lut object:

<lut reference="32" count="256" elemType="VX_TYPE_UINT8">
<uint8 index="0">255</uint8>
<uint8 index="1">0</uint8>
<uint8 index="2">1</uint8>
<uint8 index="3">2</uint8>
<uint8 index="4">3</uint8>
<uint8 index="5">4</uint8>
<uint8 index="6">5</uint8>
<uint8 index="7">6</uint8>
<uint8 index="8">7</uint8>
// skipping indicies 9-253 to save space
<uint8 index="252">251</uint8>
<uint8 index="253">252</uint8>
<uint8 index="254">253</uint8>
<uint8 index="255">254</uint8>


Schema type: matrix.type

Below is a valid example of a matrix object:

<matrix reference="14" elemType="VX_TYPE_FLOAT32" rows="3" columns="3">
<float32 row="0" column="0">-3.141593</float32>
<float32 row="0" column="1">0.000000</float32>
<float32 row="0" column="2">3.141593</float32>
<float32 row="1" column="0">-6.283185</float32>
<float32 row="1" column="1">0.000000</float32>
<float32 row="1" column="2">6.283185</float32>
<float32 row="2" column="0">-3.141593</float32>
<float32 row="2" column="1">0.000000</float32>
<float32 row="2" column="2">3.141593</float32>


Schema type: pyramid.type

Below is a valid example of a pyramid object:

<pyramid reference="35" width="24" height="16" format="U008" scale="0.500000" levels="4">
<image reference="36" width="24" height="16" format="U008">
<image reference="37" width="12" height="8" format="U008">
<image reference="38" width="6" height="4" format="U008">
<image reference="39" width="3" height="2" format="U008">


Schema type: remap.type

Below is a valid example of a remap object:

<remap reference="33" src_width="6" src_height="4" dst_width="6" dst_height="4">
<point src_x="0.500000" src_y="0.500000" dst_x="0" dst_y="0" />
<point src_x="1.000000" src_y="0.500000" dst_x="1" dst_y="0" />
<point src_x="1.500000" src_y="0.500000" dst_x="2" dst_y="0" />
<point src_x="2.000000" src_y="0.500000" dst_x="3" dst_y="0" />
<point src_x="2.500000" src_y="0.500000" dst_x="4" dst_y="0" />
<point src_x="3.000000" src_y="0.500000" dst_x="5" dst_y="0" />
<point src_x="0.500000" src_y="1.000000" dst_x="0" dst_y="1" />
<point src_x="1.000000" src_y="1.000000" dst_x="1" dst_y="1" />
<point src_x="1.500000" src_y="1.000000" dst_x="2" dst_y="1" />
<point src_x="2.000000" src_y="1.000000" dst_x="3" dst_y="1" />
<point src_x="2.500000" src_y="1.000000" dst_x="4" dst_y="1" />
<point src_x="3.000000" src_y="1.000000" dst_x="5" dst_y="1" />
<point src_x="0.500000" src_y="1.500000" dst_x="0" dst_y="2" />
<point src_x="1.000000" src_y="1.500000" dst_x="1" dst_y="2" />
<point src_x="1.500000" src_y="1.500000" dst_x="2" dst_y="2" />
<point src_x="2.000000" src_y="1.500000" dst_x="3" dst_y="2" />
<point src_x="2.500000" src_y="1.500000" dst_x="4" dst_y="2" />
<point src_x="3.000000" src_y="1.500000" dst_x="5" dst_y="2" />
<point src_x="0.500000" src_y="2.000000" dst_x="0" dst_y="3" />
<point src_x="1.000000" src_y="2.000000" dst_x="1" dst_y="3" />
<point src_x="1.500000" src_y="2.000000" dst_x="2" dst_y="3" />
<point src_x="2.000000" src_y="2.000000" dst_x="3" dst_y="3" />
<point src_x="2.500000" src_y="2.000000" dst_x="4" dst_y="3" />
<point src_x="3.000000" src_y="2.000000" dst_x="5" dst_y="3" />


Schema type: scalar.type

Below are valid examples of scalar objects:

<scalar reference="16" elemType="VX_TYPE_CHAR">
<scalar reference="17" elemType="VX_TYPE_UINT8">
<scalar reference="18" elemType="VX_TYPE_INT8">
<scalar reference="19" elemType="VX_TYPE_FLOAT32">
<scalar reference="20" elemType="VX_TYPE_FLOAT64">
<scalar reference="21" elemType="VX_TYPE_DF_IMAGE">
<scalar reference="22" elemType="VX_TYPE_UINT16">
<scalar reference="23" elemType="VX_TYPE_INT16">
<scalar reference="24" elemType="VX_TYPE_UINT64">
<scalar reference="25" elemType="VX_TYPE_INT64">
<scalar reference="26" elemType="VX_TYPE_UINT32">
<scalar reference="27" elemType="VX_TYPE_SIZE">
<scalar reference="28" elemType="VX_TYPE_BOOL">


Schema type: threshold.type

Below is are valid examples of a threshold object:

<threshold reference="29" elemType="VX_TYPE_UINT8" true_value="0" false_value="0">
<threshold reference="30" elemType="VX_TYPE_UINT8" true_value="0" false_value="0">
<range lower="10" upper="240" />

User Defined Elements

The OpenVX XML Schema extension contains two additional optional elements which are intended to aid in portability of an OpenVX graph which is dependent on additional libraries or user structs.


The 'library' element is simply a string type. If the OpenVX context is dependent on user kernels which may be defined in a separate library, then the name of this library can be listed here. This way, if the OpenVX implementation importing this XML file also has the library in the system, then it may know that it needs to load or link against the named library before parsing and loading the rest of the xml file. Because of this dependency, all library names should be listed in the xml file before any objects, as per the sequence constraint in the openvx.type of the schema. See an example below:



The 'struct' element is intended to communicate to the parser that there is a user struct defined in the context. If there are array objects which have a user struct as an element type, then the array object of this type can not be created without knowing the size of the user struct. Therefore, this size needs to be communicated as part of the xml file as the "size" attribute in the struct element before any other objects are defined, as per the sequence constraint in the openvx.type of the schema. See an example below:

<struct size="16">USER_STRUCT_0</struct>

The schema expects the label used for user structs to always be "USER_STRUCT_*", where the wildcard can be any number. This way, multiple user structs can be exported/imported using unique suffix numbers. Now that this is defined at the top of the xml file, an array can reference the same label in the implementation:

<array reference="120" capacity="4" elemType="USER_STRUCT_0">
<user>32 0 0 0 158 127 0 0 154 153 153 153 153 153 9 64 </user>
<user>64 0 0 0 158 127 0 0 154 153 153 153 153 153 25 64 </user>