G API Python Bindings
Dmitry Matveev edited this page May 27, 2023
·
5 revisions
G-API is also available in OpenCV for Python. This page explains how to build and test G-API in Python.
- Python3+ with
numpy
- OpenVINO - for inference tests with OpenVINO backend;
- ONNX RT - for inference tests with ONNX Runtime backend;
- Working
videoio
module - built with either FFMPEG or GStreamer support - as some tests are using video files as input.
Use this CMake option to enable Python (make sure to include options for OpenVINO and ONNX RT if necessary):
$ cmake /path/to/opencv -DWITH_PYTHON=ON -DCMAKE_BUILD_TYPE=Release
$ make -j8 opencv_python3
Setup environment:
$ export LD_LIBRARY_PATH=<path-to-opencv-build>/lib/:$LD_LIBRARY_PATH
$ export PYTHONPATH=<path-to-opencv-build>/python_loader/:$PYTHONPATH
$ export OPENCV_TEST_DATA_PATH=<path-to-opencv_extra>/testdata/
$ export OPENCV_DNN_TEST_DATA_PATH=<path-to-opencv_extra>/testdata/dnn
Now run G-API tests:
$ cd <path-to-opencv-build>
$ OPENCV_PYTEST_FILTER=test_gapi* python3 <path-to-opencv-root>/modules/python/test/test.py
© Copyright 2024, OpenCV team
- Home
- Deep Learning in OpenCV
- Running OpenCV on Various Platforms
- OpenCV 5
- OpenCV 4
- OpenCV 3
- Development process
- OpenCV GSoC
- Archive