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

plotter.update_coordinates, Process finished with exit code -1073740940 (0xC0000374) #225

Open
reallijie opened this issue Aug 15, 2022 · 2 comments

Comments

@reallijie
Copy link

reallijie commented Aug 15, 2022

How can I display real-time point cloud data from Lidar?

The frequency of Lidar sending data is 10 times per second, about 200,000 points each time.

I try to call plotter.update_coordinates when I receive point cloud data, it gives an error: Process finished with exit code -1073740940 (0xC0000374)

@reallijie
Copy link
Author

reallijie commented Aug 15, 2022

import os

os.environ["QT_API"] = "pyqt5"

import sys

import numpy as np
import open3d as o3d
from PyQt5 import QtWidgets, QtCore
from PyQt5.QtCore import QTimer
from PyQt5.QtWidgets import QWidget
from pyvistaqt import QtInteractor


class CustomWidget(QWidget):
    def __init__(self):
        super(CustomWidget, self).__init__()
        self.resize(800, 600)
        self.horizontalLayout = QtWidgets.QHBoxLayout(self)
        self.horizontalLayout.setContentsMargins(0, 0, 0, 0)
        self.horizontalLayout.setSpacing(0)
        self.horizontalLayout.setObjectName("horizontalLayout")

        self.tools_widget = QtWidgets.QWidget(self)
        self.tools_widget.setMinimumSize(QtCore.QSize(240, 16777215))
        self.tools_widget.setStyleSheet("background-color: rgb(170, 170, 255);")
        self.verticalLayout = QtWidgets.QVBoxLayout(self.tools_widget)
        self.btn1 = QtWidgets.QPushButton(self.tools_widget)
        self.btn1.setText('operation1')
        self.verticalLayout.addWidget(self.btn1)
        self.btn2 = QtWidgets.QPushButton(self.tools_widget)
        self.btn2.setText('operation2')
        self.verticalLayout.addWidget(self.btn2)
        spacerItem = QtWidgets.QSpacerItem(20, 100, QtWidgets.QSizePolicy.Minimum, QtWidgets.QSizePolicy.Expanding)
        self.verticalLayout.addItem(spacerItem)

        self.horizontalLayout.addWidget(self.tools_widget)
        self.frame = QtWidgets.QFrame(self)
        self.plotter = QtInteractor(self.frame)
        self.horizontalLayout.addWidget(self.plotter.interactor)

        path = os.path.dirname(os.path.abspath(__file__))
        path = os.path.join(path, 'test.pcd')
        pcd = o3d.io.read_point_cloud(path)
        self.points = np.array(pcd.points)
        self.plotter.add_points(self.points, color='red', point_size=1)

        self.generate_point_cloud_timer = QTimer()
        self.generate_point_cloud_timer.timeout.connect(self.generate_point_cloud)
        self.generate_point_cloud_timer.start(5000)

    def generate_point_cloud(self):
        random_len = int(self.points.shape[0] * .5)
        points = self.points[np.random.choice(self.points.shape[0], random_len, replace=False)]
        self.handle_real_time_point_cloud(points)

    def handle_real_time_point_cloud(self, points):
        self.plotter.update_coordinates(points)


if __name__ == '__main__':
    app = QtWidgets.QApplication(sys.argv)
    customWidget = CustomWidget()
    customWidget.show()
    sys.exit(app.exec_())

pyvista_real_time_point_cloud.zip

@reallijie
Copy link
Author

reallijie commented Aug 15, 2022

os win10 64
python  3.8.10
PyQt5  5.15.4
pyqt5-plugins  5.15.4.2.2
PyQt5-Qt    5.15.2
PyQt5-sip  12.11.0
pyqt5-tools 5.15.4.3.2
pyvista  0.35.2
pyvistaqt  0.9.0
QtPy  2.1.0
vtk 9.1.0

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