Visualize Realtime pointclouds on QT widget
-
Good morning. I am trying to visualize pointclouds on my qt widget. I have succedded in displaying a .pcd file but i would like to stream real time pointclouds on my widgets. Any suggstions?
void MainWindow::imageShowLIDAR() { //std::cout << "carico file" << std::endl; std::cout << "imageshow lidar initiated" << std::endl; cloud_pcl.reset (new PointCloudT); cloud_pcl->resize (200); red = 128; green = 128; blue = 128; pcl::io::loadPCDFile("/home/pcl1.pcd", *cloud_pcl); for (auto& point: *cloud_pcl) { //point.x = 1024 * rand () / (RAND_MAX + 1.0f); //point.y = 1024 * rand () / (RAND_MAX + 1.0f); //point.z = 1024 * rand () / (RAND_MAX + 1.0f); point.r = red; point.g = green; point.b = blue; } viewer_pcl.reset(new pcl::visualization::PCLVisualizer("viewer_pcl", false)); //Set viewer settings viewer_pcl->addCoordinateSystem(3.0, "coordinate"); viewer_pcl->setShowFPS(false); viewer_pcl->setBackgroundColor(0.0, 0.0, 0.0, 0); //viewer_pcl->setCameraPosition(0.0, 0.0, 30.0, 0.0, 1.0, 0.0, 0); ui.LIDAR_Widget->SetRenderWindow(viewer_pcl->getRenderWindow()); viewer_pcl->setupInteractor(ui.LIDAR_Widget->GetInteractor(), ui.LIDAR_Widget->GetRenderWindow()); viewer_pcl->addPointCloud (cloud_pcl, "cloud"); viewer_pcl->resetCamera (); ui.LIDAR_Widget->update(); }
looking for suggestions. Thank you
-
-
In general, it is possible. OpenGL or even Vulkan are able to output a lot of data at a time with properly written code. Both are available within Qt. You don't give any information about how your LIDAR_Widget works. If it is pure Qt without any hardware acceleration it might become really slow.
I suspect that pointclouds from LIDAR are really large. It depends on how often you receive how much data in real time if your computer can handle the throughput. There is only so much GB/s the memory and the transfer from CPU memory to the GPU can handle.
-
@SimonSchroeder Correct me if i am wrong somewhere
The GUI is created to visualize a couple of real time sensors. I dont understand what do you mean by "if its pure qt without any hardware accleration" .
I can share the bandwith and frequency of my LIDAR data, if that can be of some reference
Bandwith: 3.55MB/s
Frequency: 4.9HzI have the pointcloud data on a particular topic which i want to be displayed on the widget in real time. Just need guidance in right direction.
Thank you -
@ZaidX said in Visualize Realtime pointclouds on QT widget:
I dont understand what do you mean by "if its pure qt without any hardware accleration" .
With this I mean that you derive from
QWidget
and implementpaint()
usingQPainter
. This is comparatively slower than OpenGL or Vulkan. For these you need a QOpenGLWidget or QVulkanWindow. This then allows to use OpenGL or Vulkan directly for drawing while still using Qt for everything else (including mouse handling).@ZaidX said in Visualize Realtime pointclouds on QT widget:
Bandwith: 3.55MB/s
Frequency: 4.9HzThis sounds doable. Though it doesn't mean it is easy to reach interactive speeds.