Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • Users
  • Groups
  • Search
  • Get Qt Extensions
  • Unsolved
Collapse
Brand Logo
  1. Home
  2. Qt Development
  3. General and Desktop
  4. Visualize Realtime pointclouds on QT widget
QtWS25 Last Chance

Visualize Realtime pointclouds on QT widget

Scheduled Pinned Locked Moved Unsolved General and Desktop
qt5widgetpclvtk
6 Posts 3 Posters 1.2k Views
  • Oldest to Newest
  • Newest to Oldest
  • Most Votes
Reply
  • Reply as topic
Log in to reply
This topic has been deleted. Only users with topic management privileges can see it.
  • Z Offline
    Z Offline
    ZaidX
    wrote on last edited by
    #1

    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

    JonBJ 1 Reply Last reply
    0
    • Z ZaidX

      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

      JonBJ Offline
      JonBJ Offline
      JonB
      wrote on last edited by
      #2

      @ZaidX
      So is this a question about whether/how your "point cloud visualizer" allows you to add new points dynamically rather than just from a file? There doesn't seem to be much Qt in the code.

      Z 1 Reply Last reply
      0
      • JonBJ JonB

        @ZaidX
        So is this a question about whether/how your "point cloud visualizer" allows you to add new points dynamically rather than just from a file? There doesn't seem to be much Qt in the code.

        Z Offline
        Z Offline
        ZaidX
        wrote on last edited by
        #3

        @JonB I understand it but eventually it will be displayed on the widget. I just want to ask if such approach is possible?

        1 Reply Last reply
        0
        • SGaistS SGaist moved this topic from Language Bindings on
        • S Offline
          S Offline
          SimonSchroeder
          wrote on last edited by
          #4

          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.

          Z 1 Reply Last reply
          0
          • S SimonSchroeder

            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.

            Z Offline
            Z Offline
            ZaidX
            wrote on last edited by ZaidX
            #5

            @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.9Hz

            I 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

            S 1 Reply Last reply
            0
            • Z ZaidX

              @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.9Hz

              I 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

              S Offline
              S Offline
              SimonSchroeder
              wrote on last edited by
              #6

              @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 implement paint() using QPainter. 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.9Hz

              This sounds doable. Though it doesn't mean it is easy to reach interactive speeds.

              1 Reply Last reply
              1

              • Login

              • Login or register to search.
              • First post
                Last post
              0
              • Categories
              • Recent
              • Tags
              • Popular
              • Users
              • Groups
              • Search
              • Get Qt Extensions
              • Unsolved