Comments (4)
See this for detailed document:
http://pybind11.readthedocs.io/en/stable/advanced/cast/stl.html
TL;DR version:
By default, pybind11 automatically converts std::vector
to python list. However, the downside is that the access is copy semantic.
If you want reference semantic (as should be done for nodes_
and edges_
, you should declare it OPAQUE
. This is done by adding PYBIND11_MAKE_OPAQUE
macro in py3d.h
. See current examples:
PYBIND11_MAKE_OPAQUE(std::vector<Eigen::Vector3d>);
PYBIND11_MAKE_OPAQUE(std::vector<Eigen::Vector3i>);
PYBIND11_MAKE_OPAQUE(std::vector<Eigen::Vector2i>);
PYBIND11_MAKE_OPAQUE(std::vector<Eigen::Matrix4d>);
from open3d.
Thanks. I added
PYBIND11_MAKE_OPAQUE(std::vector<three::PoseGraphEdge>);
PYBIND11_MAKE_OPAQUE(std::vector<three::PoseGraphNode>);
but I got following error
# python
pose_graph.nodes.append(PoseGraphNode(trans))
pose_graph.edges.append(PoseGraphEdge(t, s, trans, info, False))
TypeError: Unable to convert function return value to a Python type! The signature was
(self: py3d.PoseGraph) -> std::__1::vector<three::PoseGraphNode, std::__1::allocator<three::PoseGraphNode> >
Do I need to also define pybind_eigen_vector_of_*
functions in Open3D/src/Python/py3d_eigen.cpp? I concern that would be tricky and redundant as PoseGraphEdge has many member variables.
from open3d.
I reviewed pybind11 STL containers manual carefully and found answer.
This definition should come earlier than PoseGraphEdge
PYBIND11_MAKE_OPAQUE(std::vector<three::PoseGraphEdge>);
and I need to add following line after definition of PoseGraphEdge
py::bind_vector<std::vector<PoseGraphEdge>>(m, "PoseGraphEdgeVector");
From following python script, now I can get
pose_graph = PoseGraph()
print(pose_graph)
pose_graph.edges.append(PoseGraphEdge(t, s, trans, info, False))
print(pose_graph)
[python output]
PoseGraph with 0 nodes and 0 edges.
PoseGraph with 0 nodes and 1 edges.
from open3d.
Addressed in #73
from open3d.
Related Issues (20)
- Cannot compile on Windows 10 with MinGW-w64 HOT 2
- Why is the human point cloud generated by my icp algorithm noisy
- How to get a colored ointcloud from RGBD images?
- open3d.visualization.Visualizer.get_render_option() return NoneType Object
- Is the box.GetOrientedBoundingBoxLines() deleted in recent version?
- Open3D-0.18.0\cpp\open3d\ml\impl\continuous_conv\ContinuousConvTranspose.h(73,45): error C2975: “Rows_”:“Eigen::Array”的模板参数无效,应为编译时常量表达式
- Global & Local Registration result not good
- Laggy Open3D Visualizer for Large Point Clouds on Ubuntu 20.04
- Cannot compile for embedded aarch64 without GLFW (and other stuff?) even with BUILD_GUI=OFF
- Implement 3D Gaussian splatting viewer
- 🚀 Upgrade to Embree 4 and add GPU support
- 🚀 Faster UV Unwrapping
- 🚀 Add surface contouring to TriangleMesh
- 🚀 Parallel fast mesh simplification
- Test and integrate oneDAL
- Integrate DNN runtime for running inference in C++
- Complete support for scene graph and add USD I/O
- How can I konw the length of each line in lineset?
- Is it expected behavior for the application to crash when minimized? GUI
- Rebuild well on Windows, but worse in ubuntu, using the same parameters and data
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from open3d.