Axis Communications is no longer maintaining this project.
Tools for OpenVX C code generation from graphical calculation graph definitions. Includes a Python based parser which takes graphs defined in graphml format and generates valid OpenVX C code.
We use example/threshold_example.graphml
as example graph file. Please open this in yEd and see what it looks like.
This assumes you have an OpenVX implementation installed with libraries in environment variables $OPENVX_LIB_DIR
and headers in $OPENVX_INCLUDE_DIR
.
Here we have used the OpenVX 1.2 sample code.
-
First we generate the necessary stripped OpenVX graph files, note the
--strip
option:python graph_parser/parse_graph.py -f example/threshold_example.graphml --strip --output_dir=example
The generator should now have created two new C-files which we can compile.
-
Inspect the generated files:
less example/threshold_example_strip.{c,h}
-
Compile the dependency for the standalone test, here we call the compiled object file
threshold_example_graph.o
:gcc -c example/threshold_example_strip.c -o example/threshold_example_graph.o -L $OPENVX_LIB_DIR -I $OPENVX_INCLUDE_DIR -lopenvx
-
Template code for using the generated graph code is provided at
example/standalone_test_strip_template.c
. An already modified template can is provided atexample/standalone_test_threshold_example_strip.c
. Compile the standalone test binary intotest_threshold_example
usingthreshold_example_graph.o
:gcc example/threshold_example_graph.o example/standalone_test_threshold_example_strip.c -o example/test_threshold_example -L $OPENVX_LIB_DIR -I $OPENVX_INCLUDE_DIR -lopenvx
-
Run the created test program
test_threshold_example
using some input images, e.g. lena.pgm and baboon.pgm. Currently only PGM images are supported. The image ordering should correspond to the indexing defined in the graphml and provide the corresponding width and height:(cd example && LD_LIBRARY_PATH=$OPENVX_LIB_DIR ./test_threshold_example ~/Downloads/lena.pgm ~/Downloads/baboon.pgm 512 512)
-
Inspect the created outputs.
ls example/*.pgm
Generated documentation for the Python parser is provided here.
-
Install epydoc. (On Debian do
apt install python-epydoc
) -
From the top graph_parser folder, run the following command:
epydoc --parse-only --html graph_parser -o graph_parser/doc