Skip to content

Wrapper to communicate C++ with Python using pybind11

Notifications You must be signed in to change notification settings

mgrova/comm_pycpp

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

4 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

comm_pycpp

This repo shows how to embed inside a C++ object any Python class. In that way, we could easily integrate functionalities developed in Python with our C++ code.

An example use case, which is shown in this repo, is to embed the inference of a deep learning model implemented in Python inside a C++ object.

Dependencies

The only required dependencies are Python3 and PyBind11. To show the use case, Opencv has also been added.

sudo apt install python3-dev
  • OpenCV
sudo apt install libopencv-dev

Build

git clone https://github.com/mgrova/comm_pycpp & cd comm_pycpp && \
mkdir build && cd build && \
cmake -DCMAKE_BUILD_TYPE=Release .. && make

Usage

Add your classes to py_src folder and take a look to the PyToCppWrapper class. It should be easy to adapt it to your own needs.

After build the repo, we have the following executable to run it:

./build/comm_pycpp/wrap_example

About

Wrapper to communicate C++ with Python using pybind11

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published