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)
- Minimal oriented bounding box is not minimal HOT 1
- C++ Types in Python Documentation HOT 1
- Open3D development wheels are unavailable HOT 2
- Animation camera trajectory json creation
- Open3D on WSL2 unable to visualize. Error: GLFW Error: Wayland: The platform does not support setting the window position, Failed to initialize GLEW., [DrawGeometries] Failed creating OpenGL window. HOT 1
- how to set VerbosityContextManager in c++ HOT 2
- multiview registration without odometry edge.
- Hidden point removal crashes silently HOT 5
- Silent Failure when assigning color to point cloud points, and/or creating coordinate frame triangle mesh. HOT 2
- generalizedICP get nan value.
- generalizedICP get nan value.
- issue in building open3d in jetson orin
- ICP registration crashes in visualization/draw
- Crash on construction of `o3d.visualization.VisualizerWithEditing` HOT 1
- Why is my computer reporting this error "Process finished with exit code -1073741819(0xC0000005)" HOT 4
- Bilateral Filters in PointClouds
- Not able to copy/paste from system clipboard into gui.TextEdit
- Unable to set background image of O3DVisualizer HOT 2
- How can I apply a transformation only once in open3D HOT 2
- Request to customize origin and size in octree.convert_from_point_cloud() HOT 1
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.