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)
- crash when click parent dir in open3d draw open dialog
- Is it possible to use open3d visualization using tensorboard on a headless server? HOT 4
- try to generate the point cloud using o3d.geometry.PointCloud.create_from_depth_image , but the position of the point cloud is incorrect
- Add support for IO for e57 and las files
- Summarize the bug (e.g., "Segmentation Fault for Colored Point Cloud Registration")
- Open3D Visualizer not updating the window size correctly or at the right moment in the code execution.
- Development docs are out of date (not updated by CI)
- Enhanced Support for Character Abilities and Capacities HOT 1
- doppler_icp exception
- Cannot run OnlineSLAMRealSense.exe on Windows 10, Open3D v0.17.0
- The url of development pip package is invalid for Linux system HOT 3
- how to export or render model to image in Open3D Viewer module on condition of window hidden?
- Request: publish a distribution that works with Python 3.10 under Nix on macOS HOT 2
- Visualization rendering few points only
- Unable to link Open3D 0.18.0 to existing c++ project in Xcode [macOS arm64] HOT 4
- RANSAC exits early when no checker is passed
- Boolean intersection fails when one mesh encapsulates the other
- Segmentation Fault for extract_voxel_grid
- Reconstruction results of TUM freiburg1_room dataset
- pip install open3d on apple silicon Mac HOT 3
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.