pybind11的使用教程已经有很多了,参考https://zhuanlan.zhihu.com/p/93299698
,建议使用vcpkg安装pybind11 pybind11:x64-windows-static等等库
我的接口形式为
void face_handler(py::module& m) {
py::class_(m, "RFInfer")
.def(py::init())
.def("__call__", &RFInfer::operator())
.def("init_rf", &RFInfer::init_RF)
.def("destroy_rf", &RFInfer::destroy_RF);
py::class_(m, "FaceInfoPY")
.def_readwrite("bbox", &FaceInfoPY::bbox)
.def_readwrite("landmark", &FaceInfoPY::landmark)
.def_readwrite("score", &FaceInfoPY::score);
py::class_(m, "AFInfer")
.def(py::init())
.def("__call__", &AFInfer::operator())
.def("init_af", &AFInfer::init_AF)
.def("destroy_af", &AFInfer::destroy_AF);
}
<