Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Visual 3d point directly from numpy array #664

Closed
lucasjinreal opened this issue Nov 6, 2018 · 10 comments
Closed

Visual 3d point directly from numpy array #664

lucasjinreal opened this issue Nov 6, 2018 · 10 comments
Labels

Comments

@lucasjinreal
Copy link

Does it support visualize numpy array?

@yxlao
Copy link
Collaborator

yxlao commented Nov 6, 2018

Almost -- first we'll need to create a PointCloud from the numpy array.

import numpy as np
import open3d

points = np.random.rand(10000, 3)
point_cloud = open3d.PointCloud()
point_cloud.points = open3d.Vector3dVector(points)
open3d.draw_geometries([point_cloud])

@syncle syncle added the question label Nov 6, 2018
@syncle
Copy link
Contributor

syncle commented Nov 7, 2018

I think we can say "yes" :) Thanks to #657, there is almost no overhead.

@lucasjinreal
Copy link
Author

@syncle @yxlao Many thanks. Open3D is a very good library, the only question is that it's not work very well with IDE for code suggestions such as PyCharm in Python interface. Would be better to promote it, then it could be good as OpenCV

@yxlao
Copy link
Collaborator

yxlao commented Nov 7, 2018

Could that be some config issues in PyCharm?

For example, Jupyter notebook does code suggestions pretty well:
screen shot 2018-11-06 at 6 07 30 pm

There are two cases: (1) pure Python code and (2) compiled C++ python module (and Open3D has a lot of them). Apparently, Jupyter suggestion works for both (1) and (2).

My guess is that PyCharm is configured to only to show case (1)? If this is the case, do you have suggestions on how to "promote" case (2) to be case (1) for PyCharm?

@lucasjinreal
Copy link
Author

I saw Open3D source codes, it did some promote suggestion optimization in Jupyter notebook. But not in pure python, I mean, pycharm or vscode can not work with that. If you try pycharm, you will see Open3D just failing at any code suggestions

@yxlao
Copy link
Collaborator

yxlao commented Nov 7, 2018

From this https://stackoverflow.com/a/5196184/1255535, it seems to be possible to set up in PyCharm. Though there are other reports saying that it is not possible with PyCharm.

I did a quick comparison with opencv. The __init__.py file look almost identical, so if opencv autocomplete works, open3d shall also work

Coud you check your installed opencv and see if there are some additional tricks? 🕵️

@lucasjinreal
Copy link
Author

lucasjinreal commented Nov 7, 2018

@yxlao Thanks for your quick look. __init__ file actually identical. I think maybe it's installation process makes sure the child package importable in IDEs. I am not quite specialized in Python package writing, hoping for your guys improve it in the future and make Open3D a great library though

@yxlao
Copy link
Collaborator

yxlao commented Nov 9, 2018

@jinfagang looked at it again today, turned out to be an easy fix #676

@lucasjinreal
Copy link
Author

@yxlao The API seems broken looks from today. I updated it here for users might got into this issue:

point_cloud = o3d.geometry.PointCloud()
point_cloud.points = o3d.utility.Vector3dVector(ptc)

o3d.visualization.draw_geometries([point_cloud])

@seo-jiwoo-code
Copy link

visualization
I tried this but get the error RuntimeError: Unable to cast Python instance to C++ type (compile in debug mode for details) ? I'm trying to just purely use python here. tried changing points to float64 but seems to have shape error too.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

4 participants