How to maintain the Python wrapper with Cython.
The Cython documentation: http://cython.org/
The Cython wiki: https://github.com/cython/cython/wiki
The ZED SDK documentation: https://www.stereolabs.com/developers/documentation/API/latest
New packages can simply be added in the GPUmodulesTable with the package name and its .pyx file.
The version of the SDK and the wrapper is the same and should be indicated in the setup version.
Check the new Cython versions, they may need to update the wrapper.
The wrapper keeps the same structure as the ZED SDK.
The classes of the wrapper contain a maximum of Python functions like str, repr, gettitem, settitem and properties.
.pxd files correspond to C++ headers and contain all the C++ methods and functions that can be used in the wrapper. .pyx files contain methods, functions and their bodies.
Python and C++ functions must be named differently.
Warning about deprecated Numpy API is showing during building but we can ignore it.
Enum must be redefined in order to use them with Python. They have their own representation so you must redefine str and repr if there is a string conversion function.
Enum arguments can't be typed directly with classes defined in the wrapper. They must be tested inside the functions.
Each representation of matrix or vectors are done with Numpy.
Template can't be used with Cython. Each function with a different type must be defined in a file like Utils.cpp
typedef made inside classes is not working in Cython. We can create it outside of the class and link it to its C++ declaration directly. See MeshFilterParameters FILTER in mesh.pxd for example.
Ctypes can be used, for example with bool type or memcpy.
Vector2, Vector3, Vector4; float1, float2, float3, float4; uchar1, uchar2, uchar3, uchar4 are not available in Python but can be used in the wrapper.
Other classes attributes must be declared in .pxd file instead of .pyx file if you want to have access to them when the package is imported.
Default values of function arguments must be given in the Python function in .pyx file but not in the declaration in the .pxd.
Python does not support constructor overloading but Cython does. However, this is not working when the number of arguments is the same but the types are different. The other constructors are defined in a C++ file with another name and called as a function after the creation of the Python object.
When there is an object to get defined in another file, it must be given in parameters if not Python will interpret it as a C++ type trying to be converted in Python object and won't work.
Subclasses of Matrix3f and Matrix4f have both Matrix and their own type as attributes. For example: PyTransform has a sl::Transform and sl::Matrix4f attributes initialized.
Python will crash if you return a C++ object not initialized (like an empty sl::String).
memcpy is used when there is not any access to pointer data directly.
PyMat/Mat constructor with resolution and pointer not working directly when Mat constructors with width and height are defined because of the same number of arguments, replaced by matResolution redefined in Utils.cpp.
Normalise(const Orientation orient)
is not working, replaced by normalizing the Orientation argument with normalise().
Overloading operators like *=, /=, += and -= (for Vector3 and Vector4) are not supported by Cython.
此处可能存在不合适展示的内容,页面不予展示。您可通过相关编辑功能自查并修改。
如您确认内容无涉及 不当用语 / 纯广告导流 / 暴力 / 低俗色情 / 侵权 / 盗版 / 虚假 / 无价值内容或违法国家有关法律法规的内容,可点击提交进行申诉,我们将尽快为您处理。