Skip to content

G API Python Bindings

Dmitry Matveev edited this page May 27, 2023 · 5 revisions

Intro

G-API is also available in OpenCV for Python. This page explains how to build and test G-API in Python.

Requirements

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

Building

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

Testing

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
Clone this wiki locally
pFad - Phonifier reborn

Pfad - The Proxy pFad of © 2024 Garber Painting. All rights reserved.

Note: This service is not intended for secure transactions such as banking, social media, email, or purchasing. Use at your own risk. We assume no liability whatsoever for broken pages.


Alternative Proxies:

Alternative Proxy

pFad Proxy

pFad v3 Proxy

pFad v4 Proxy