没有合适的资源?快使用搜索试试~ 我知道了~
Extending PCL for use with Python Bindings generation using Pybi...
需积分: 13 1 下载量 49 浏览量
2020-12-23
11:00:36
上传
评论
收藏 752KB PDF 举报
温馨提示
试读
30页
Extending PCL for use with Python Bindings generation using Pybind11,介绍如何使用Pybind11生成Python Bindings。
资源详情
资源评论
资源推荐
Extending PCL for use with Python: Bindings generation
using Pybind11
(Proposal for Google Summer of Code, 2020)
Name and Contact Information
Name: Divyanshu Madan
Github: divmadan
Gitter: divmadan
Email: divyanshumadan99@gmail.com
Postal Address: 4-Cha-18, Jawahar Nagar, Jaipur, Rajasthan
Country: India
Phone: (+91) 9261700477
Primary Language: English
About the document
This document is very extensive and requires a section about itself, to stay sane. A few points:
● It documents various tools, existing solutions, other project’s solutions etc. along with my proposal,
how to tackle insufficiencies, timeline, etc.
● The “research” part (existing solutions, analysis, etc) is very extensive, difficult to structure in tabular
form, and hard to summarize. Thus, it takes up a lot of space in the document.
● I have tried to make the sections independent of each other, so you can safely skip parts of the
document, in case you want to.
● I have limited the headings up to 3 levels (H2, H3, H4).
A simplified skeleton or structure of the document:
C++ and Python
Motivation: why create bindings for PCL?
Existing binding solutions (for PCL)
|_Pcl.py
…
Analysis of other open-source projects’ bindings
|_OpenCV-Python
…
Analysis of available support tools and libraries for binding generation
|_Why use tools?
...
The Proposal
|_The idea
…
Stretch Goals
|_Jupyter Visualization
…
Timeline
Biographical Information
Table of Contents
Extending PCL for use with Python: Bindings generation using Pybind11 1
Name and Contact Information 1
About the document 1
Table of Contents 2
C, C++ and Python 4
Motivation: why create Python bindings for PCL? 5
Existing binding solutions (for PCL) 5
Pcl.py 5
Implementation 5
Issues 5
Lacking as PCL bindings 5
Pclpy 6
Implementation 6
Issues 6
Lacking as PCL bindings 6
Pypcd 6
Implementation 6
Issues 6
Lacking as PCL bindings 6
Python-PCL 6
Implementation 6
Issues 6
Lacking as PCL bindings 7
Analysis of other open-source projects’ bindings 7
OpenCV-Python 7
Implementation 7
Issues 7
Final notes 8
VTK-Python 8
Implementation 8
Issues 8
Final notes 9
Open3D 9
Implementation 9
Issues 9
Final notes 9
Analysis of available support tools and libraries for binding generation 10
Why use tools? 10
Some discussion points 10
Boost.Python 10
User-guided wrapping 10
The advantage over Python C API 11
Pros 11
Cons 11
Final notes 11
CFFI: C Foreign Function Interface for Python 11
Pros 11
Cons 11
Final notes 12
CLIF 12
Implementation 12
Final notes 12
Cython 12
Implementation 13
Pros 13
Cons 13
How to bind? 13
Final notes 13
CPPYY 13
Implementation 13
Final notes 14
SWIG 14
Implementation 14
Pros 14
Cons 14
Final notes 15
PyBindGen 15
Implementation 15
Pros 15
Cons 16
Final notes 16
Pybind11 16
Implementation 16
Pros 16
Cons 16
Final notes 17
Other Projects 17
Comparison figures 17
Compiled set of benchmarking graphs (source code by pybindgen) 17
Compilation time benchmarking (by pybind11) 18
File size of module benchmarking (by pybind11) 18
Cppyy research paper benchmarking 19
Proposal 21
The idea 21
Choosing Pybind11 21
Initial proof of concept using SWIG 21
Open3D’s model in detail 22
Folder skeleton 22
A module in-depth 22
Binding all modules 23
Notes 25
Lack of automation: OpenCV’s inference 25
Header parsing solution 25
Why not binder? 26
Scripting solution 26
PyPi integration 26
Testing 26
Stretch Goals 27
Jupyter Visualization 27
Docstrings addition 28
Javascript Bindings 28
Timeline 28
Biographical Information 29
C, C++ and Python
As described by Boost.Python:
Python and C++ are in many ways as different as two languages could be: while C++ is usually compiled to
machine-code, Python is interpreted. Python's dynamic type system is often cited as the foundation of its
flexibility, while in C++ static typing is the cornerstone of its efficiency. C++ has an intricate and difficult
compile-time meta-language, while in Python, practically everything happens at runtime.
These very differences mean that Python and C++ complement one another perfectly. Performance
bottlenecks in Python programs can be rewritten in C++ for maximal speed, and authors of powerful C++
libraries choose Python as a middleware language for its flexible system integration capabilities.
Furthermore, the surface differences mask some strong similarities:
● 'C'-family control structures (if, while, for...)
● Support for object-orientation, functional programming, and generic programming (these are both
multi-paradigm programming languages.)
● Comprehensive operator overloading facilities, recognizing the importance of syntactic variability for
readability and expressivity.
● High-level concepts such as collections and iterators.
● High-level encapsulation facilities (C++: namespaces, Python: modules) to support the design of
reusable libraries.
● Exception-handling for effective management of error conditions.
● C++ idioms in common use, such as handle/body classes and reference-counted smart pointers
mirror Python reference semantics.
Given Python's rich 'C' interoperability API, it should in principle be possible to expose C++ type and
function interfaces to Python with an analogous interface to their C++ counterparts.
However, the facilities provided by Python alone for integration with C++ are relatively meagre:
● Compared to C++ and Python, 'C' has only very rudimentary abstraction facilities, and support for
exception-handling is completely missing.
● 'C' extension module writers are required to manually manage Python reference counts, which is
both annoyingly tedious and extremely error-prone.
● Traditional extension modules also tend to contain a great deal of boilerplate code repetition which
makes them difficult to maintain, especially when wrapping an evolving API.
These limitations have led to the development of a variety of wrapping systems to overcome these issues
and utilise the complement ability of C++ and Python, for efficient and rapid development in the community.
Motivation: why create Python bindings for PCL?
● Bindings can be used to take advantage of a large, tested, stable library written in C++ in Python. A
perfect reason to develop Python bindings for PCL.
● It encourages software reuse and reduces the requirement of reimplementing a library in several
languages.
● Generating bindings for PCL will help rapid development in Python while utilising the speed and
efficiency of the underlying C++ API.
● It will also enable python users to take advantage of the C++ based PCL, thus expanding the user
base of the library.
Existing binding solutions (for PCL)
Pcl.py
Implementation
● Pcl.py implements a Cython library to process point clouds, combined with Scipy and Numpy.
● It uses CMake, has ROS support and uses PClPointCloud2 instead of PointCloud.
Issues
● The heavily templated part of PCL is not implemented in this library due to the limitation of Cython
(Cython doesn’t support a template technique similar to “covariant”).
● It adds templated Cython headers to overcome this limitation and the user has to write that part in
C++ and then wrap the I/O in Python which is a lot of work.
Lacking as PCL bindings
● It is an implementation of PCL in Cython, it doesn’t use any support tools for the binding, thus
everything needs to be handled manually, almost impossible due to the active development of PCL
itself.
● The library is under heavy construction, it is advised not to use it in production codes.
剩余29页未读,继续阅读
TracelessLe
- 粉丝: 5w+
- 资源: 466
上传资源 快速赚钱
- 我的内容管理 展开
- 我的资源 快来上传第一个资源
- 我的收益 登录查看自己的收益
- 我的积分 登录查看自己的积分
- 我的C币 登录后查看C币余额
- 我的收藏
- 我的下载
- 下载帮助
安全验证
文档复制为VIP权益,开通VIP直接复制
信息提交成功
评论0