Describe the bug
A clear and concise description of what the bug is.
I don't know if this is a bug but I m trying to understand why the vscode python intelisense can't autocomplete with this package, I have seen the same exactly behavior when I m using the OpenCV with VsCode put I solved by adding this setting, inside the vscode settings.json
"python.linting.pylintArgs": [
"--extension-pkg-whitelist=cv2"
],
with this, the vscode intelisense work as expected and I can navigate through the opencv api.
but I canot do the same with the Open3D, what is the difference from other puthon packages that open3D have been build.
Can someone check this?
I think the majority of the developers in this days use VsCode as the main code editor and is gonna be very helpful for the developers if they can navigate the open3d methods.
Thank you.
To Reproduce
Steps to reproduce the behavior:
from open3d import (
read_image, create_rgbd_image_from_color_and_depth, create_point_cloud_from_rgbd_image,
PinholeCameraIntrinsic, PinholeCameraIntrinsicParameters, draw_geometries)
import matplotlib.pyplot as plt
# openImgWithCV('../TestData/RGBD/color/00000.jpg')
if __name__ == "__main__":
print("Read Redwood dataset")
color_raw = read_image("../TestData/RGBD/color/00000.jpg")
depth_raw = read_image("../TestData/RGBD/depth/00000.png")
rgbd_image = create_rgbd_image_from_color_and_depth(color_raw, depth_raw);
print(rgbd_image)
# plt.subplot(1, 2, 1)
# plt.title('Redwood grayscale image')
# plt.imshow(rgbd_image.color)
# plt.subplot(1, 2, 2)
# plt.title('Redwood depth image')
# plt.imshow(rgbd_image.depth)
# plt.show()
pcd = create_point_cloud_from_rgbd_image(rgbd_image, PinholeCameraIntrinsic(PinholeCameraIntrinsicParameters.PrimeSenseDefault))
# Flip it, otherwise the pointcloud will be upside down
pcd.transform([[1, 0, 0, 0], [0, -1, 0, 0], [0, 0, -1, 0], [0, 0, 0, 1]])
draw_geometries([pcd])
# print(draw_geometries([]))
print(pcd)
Expected behavior
I expected to navigate to the open3D code after I clicl in some function so I can read the documentation as a result I will understand better my code.
Screenshots
If applicable, add screenshots to help explain your problem.
Desktop (please complete the following information):
Additional context
Add any other context about the problem here.
Good point.
The reason that you cannot ctrl+click into the function is that the python functions are only wrappers of C++ functions. So there is no underlying python implementation and VSCode does not know where to navigate into. I think OpenCV has the same issue. I am not able to ctrl+click into any cv2 functions even with cv2 whitelisted.
But other than ctrl+click, other functions (e.g., autocomplication) should work well with Open3D. There is only one known issue: sometimes you need to import open3d.open3d in order to enable autocomplication. I am still not sure why this nested namespace happens. We need to look into this.
Having said that, there are workarounds for ctrl+click too - it's just Open3D is still too young and we haven't got time to implement them. For example, numpy and TensorFlow both have C++ implementation and python interface. But they both added an intermediate layer between them. Thus you can click into the functions - although what you can see is basically the function help message and a wrapper implementation.
@qianyizh, thanks for your response, this is my fault, I have forgotten that Open3D is a new project, I hope in the future this issue will be resolved.
Also, I want to thank you for open sourced this project, is an amazing tool 👍
There is only one known issue: sometimes you need to import open3d.open3d in order to enable autocomplication. I am still not sure why this nested namespace happens.
@qianyizh: It is because we are packaging open3d as the combination of open3d and j-visualizer. This change was added when we begin to support visualization for Jupiter notebook.
@yxlao: We have discussed this issue before via discord. Can we follow-up this?
I believe this was fixed in https://github.com/IntelVCL/Open3D/pull/676, but it's not available in v0.4.0 yet. This fix is tested on Pycharm, and in princeple it shall also work on VSCode.
@George35mk, to enable this feature, you could compile master from source, or add the same https://github.com/IntelVCL/Open3D/pull/676 fix
from .open3d import * # py2 py3 compatible
to the __init__.py file of the pip-installed Open3D. OpenCV has the same import, so it shall work in the same way.
The installed Open3D can be located by:
(open3d3-online) ➜ ~/repo/playground python -c "import open3d; print(open3d)"
<module 'open3d.open3d' from '/Users/ylao/repo/venvs/open3d3-online/lib/python3.6/site-packages/open3d/open3d.cpython-36m-darwin.so'>
I found a fix.
To fix this, go to Settings in VSCode and search for “Jedi” and enable the engine. Then you have to reload VSCode.
I already had Jedi enabled. Unless there is a specific configuration that resolves this issue, then the proposed solution is not successful.