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

Obtain the coordinates of a point cloud using the mouse in GLViewWidget with pyqtgraph. #2913

Open
dx-momo opened this issue Jan 9, 2024 · 1 comment

Comments

@dx-momo
Copy link

dx-momo commented Jan 9, 2024

I want to obtain the coordinates of a point cloud using the mouse in GLViewWidget. The point cloud is read using Open3D and displayed using pyqtgraph. opengl. However, I don't know how to obtain the 3D world coordinates, so I can only obtain the screen coordinates. The following is my point cloud reading and visualization code. I am using pyqtgraph version 0.13.3 and pyqt5 version 5.15.9. Can anyone help me? Thank you very much.
`def read_pointcloud(self):
# print("test well")
fileName, _ = QFileDialog.getOpenFileName(None, "选择 .pcd 文件", "", "PCD Files (*.pcd)")
if fileName != '':
self.pcd = o3d.io.read_point_cloud(fileName)
pos_view=self.pcd.get_center()
self.textEdit.clear()
np_points = np.asarray(self.pcd.points)

        self.textEdit.append("文件路径:" + str(fileName))
        self.textEdit.append("点云数量:" + str(int(np_points.size/3)))
        self.plot = gl.GLScatterPlotItem()
        self.plot.setData(pos=np_points, color=(0.0, 1.0, 1.0, 1.0), size=5, pxMode=True)  # 0.05表示点的大小
        self.openGLWidget.addItem(self.plot)
        self.openGLWidget.setCameraPosition(QtGui.QVector3D(pos_view[0],pos_view[1],pos_view[2]))

`

@dx-momo
Copy link
Author

dx-momo commented Jan 9, 2024

It seems that my pyqtgraph version is too high, so some of the previous functions have been deprecated, such as maptoscience, maptoview, and other methods

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

No branches or pull requests

1 participant