Skip to content
This repository has been archived by the owner on Dec 20, 2022. It is now read-only.

Tool for code generation based on openvx graph representations. (THIS PROJECT IS NO LONGER MAINTAINED)

License

Notifications You must be signed in to change notification settings

AxisCommunications/openvx-graph-parser

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

18 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

END-OF-LIFE NOTICE

Axis Communications is no longer maintaining this project.

openvx-graph-parser

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.

Prerequisites

  • yEd - A tool to graphically edit the graph definitions
  • Python2.7 - TODO: Update package to Python3

Example usage as standalone test from graph file

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.

  1. 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.

  2. Inspect the generated files:

    less example/threshold_example_strip.{c,h}
    
  3. 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
    
  4. Template code for using the generated graph code is provided at example/standalone_test_strip_template.c. An already modified template can is provided at example/standalone_test_threshold_example_strip.c. Compile the standalone test binary into test_threshold_example using threshold_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
    
  5. 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)
    
  6. Inspect the created outputs.

    ls example/*.pgm
    

Documentation for the Python parser

Generated documentation for the Python parser is provided here.

Generating new HTML documentation

  1. Install epydoc. (On Debian do apt install python-epydoc)

  2. From the top graph_parser folder, run the following command:

    epydoc --parse-only --html graph_parser -o graph_parser/doc
    

About

Tool for code generation based on openvx graph representations. (THIS PROJECT IS NO LONGER MAINTAINED)

Topics

Resources

License

Code of conduct

Security policy

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published