简体   繁体   中英

Wrapping C++ project using cython

I would like to wrap a c++ project using cython for using inside a python code. The main class has instances from other local classes. Do I have to write pyx files for every class that has been used or wrapping only the main class is enough?

Thank you in advance!


Edit:

Here is the code that I want to wrap: https://github.com/vojirt/asms/tree/master/src I would like to wrap colortracker function, as other classes are used in this class, do I need to wrap them as well?

Thanks to DavidW, the problem is solved. I used this code for wrapping cv::Mat:

cdef extern from "opencv2/core/core.hpp" namespace "cv":
    cdef cppclass Mat:
        Mat() except +
        void create(int, int, int)
        void* data

It was only needed to wrap classes and functions directly used in public functions of colortracker class.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM