简体   繁体   中英

How to use opencv (c++) code in blender?

I am working on hand gesture recognition using computer vision for motion simulation. I do not have as good knowledge of python as i have of c++ and hence have programmed an opencv code in c++. Now i want this code to work in a blender. Please tell me how can i integrate this code in blender.

Without altering blender's source code and compiling your own custom version , you will need to use an addon to use your code within blender. Blender uses python for it's addon system, each addon is a python module . You can use python's ctypes module to call compiled code from a python script.

While normally an addon is written in python it is possible to use or integrate a compiled C/C++ python module that can be used in blender. I'm not 100% sure if you can compile the module and add it to blender's addon folder or whether you need to have a folder with the library and a small python script that loads it.

You may want to look at cython , it takes python code and turns it into C/C++ code that can be compiled, this may give you a starting point to linking with your code. Have a look at CubeSurfer for an example of using cython for a blender addon.

For blender specific help you will find blender.stackexchange.com better.

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