python - how to write pybind11_module when used point cloud library
问题描述
I am writing a python project, and I need a module of point cloud reconstruction to polygon mesh and other operations. So I write these modules in C++ by calling Point Cloud Library(PCL), Eigen and Pybind11. Except Eigen::Matrix, pcl::PointCloud, pcl::PolygonMesh, I still define some new classes. But in the interface function "PreProcess"(python call this function) I only use Eigen::Matrix and std::vector, which are all support by pybind11, PCL classes and my self-defined classes are only used in some middle sub functions.
I have tried some easy toy codes(only use Eigen and Pybind11), use the bellow "PYBIND11_MODULE" can be compiled successfully, Pybind can support Eigen::Matrix and C++ std::vector.
Now in my c++ project, when I using the same "PYBIND11_MODULE" with the essy toy code, it can not pass compiling, with error:
/home/helanyi/Documents/pgnn/utils/surface_reconstruct/src/test.cpp:931:16: error: expected constructor, destructor, or type conversion before ‘(’ token PYBIND11_MODULE(process, m) {
So I want to ask that how do I write the "PYBIND11_MODULE"? Need I define the pcl classes and my self-defined classes in the "PYBIND11_MODULE"? Thank you so much!
PYBIND11_MODULE(process, m) {
m.doc() = "pybind11 example plugin";
m.def("PreProcess", &PreProcess);
}
解决方案
推荐阅读
- typescript - 如何从数组对象中获取类型
- javascript - 是否可以使 Window.Print() 方法使用其背景颜色打印突出显示的文本?
- python - python 和 conda 路径不相同,并出现 ModuleNotFoundError: No module named 'torch' 错误
- r - 从稀疏矩阵转换为密集矩阵而不丢失暗名?
- graphql - GraphQL 查询 DynamoDB 表的问题
- rabbitmq - Clickhouse 和 RabbitMQ 的连接问题
- r - 如何将矩阵数据输入brms公式?
- events - 是否可以从 U 盘查看事件
- python - 如何将 python 文件中的(数据)列表导出到单独的外部文件中?
- bigbluebutton - 在 BigBlueButton 中禁用结束会议选项