python call c++ function---传参
来源:互联网 发布:淘宝订单号在哪里找 编辑:程序博客网 时间:2024/05/28 23:22
紧接上文,举个实栗吧
c++ function:
extern "C" void segment(unsigned char* inputimage,unsigned char* outputimage,float a,int c){...}
python 传入两张ndarray 格式的image,参数传入需要变换数据类型。
import ctypes as Cprojectname.functionname(inputimage.ctypes.data_as(C.POINTER(C.c_ubyte)),outputimage.ctypes.data_as(C.POINTER(C.c_ubyte)),(C.c_float)(0.9),(C.c_int)(3))
接下来的主要问题是,进到C++里面,怎么用这两个unsigned char*类型的图片呢?以下提供两种思路:
输入转化为mat,方便接下来对图像的处理
Mat inputimageMat(inputimage_rows,inputimage_cols,CV_8UC3,inputimage);
输出转化为mat,由于把输出图像的地址用来初始化这个mat,对这个mat的修改就是对输出图像的修改了。
Mat python_data(inputimageMat.rows,inputimageMat.cols, CV_8UC1, _outputimage);
0 0
- [Tech] Python Call C function
- python call c++ function---传参
- Python---function call
- COBOL call C function
- lua call c/c++ function
- python call c
- python call c dll
- Python Function Definition and Funcion Call Discussion
- C Function Call Conventions and the Stack
- C Function Call Conventions and the Stack
- How C#/Python Call DLL
- call lua function from c and called back to c
- how to call c++ function in python coding in linux?
- Error: could not call python function 'rosdep2.rospack.init_rospack_interface'
- How to call an external C function from within Oracle
- How do I call a C++ function from C?
- [c++]no matching function for call to ‘sort(…)......
- lua study -- how to call lua function use C language
- 数据库Sharding的基本思想和切分策略
- 剑指offer-面试题2-实现singleton模式
- 一像素进程保活
- poj3862 Asteroids【模板题】
- 几种范式详解
- python call c++ function---传参
- tomcat中conf\Catalina\localhost内容分析
- Elasticsearch之elasticsearch5.x 新特性
- 对于字符型字节型使用toString
- LeetCode-8. String to Integer (atoi)
- react this.state + 组件生命周期
- Spring事务处理案例总结 rollback-for使用
- 关于rightBarButtonItems多个控件之间的间距调整。
- ThinkPHP之增删改查之连贯操作