0

I have this very simple tool that visualizes lidar sensor data online using Opencv. I want to create a GUI for it but I am a noob in the area. Any suggestions for material or examples? The GUI needs to do only two things for now:

  1. Take the sensor data as input though the LAN Port.
  2. Visualize it.

Here is what I have come up with based on a few YouTube videos. How should I proceed?

private: int Display_Point_Cloud() {
  // Create Viewer
  cv: :viz::Viz3d viewer("Velodyne");
  const boost: :asio::ip::address address=boost::asio::ip::address::from_string("192.168.1.77");
  const unsigned short port=2368;
  velodyne: :VLP16Capture capture(address, port);
  std: :vector<velodyne::Laser> lasers;
  capture>>lasers;
  std: :vector<cv::Vec3f> buffer (lasers.size());
  for (const velodyne: :Laser& laser: lasers) {
    const double distance=static_cast<double>(laser.distance);
    const double azimuth=laser.azimuth * CV_PI / 180.0;
    const double vertical=laser.vertical * CV_PI / 180.0;
    float x=static_cast<float>((distance * std: :cos(vertical)) * std::sin(azimuth));
    float y=static_cast<float>((distance * std: :cos(vertical)) * std::cos(azimuth));
    float z=static_cast<float>((distance * std: :sin(vertical)));
    if (x==0.0f && y==0.0f && z==0.0f) {
      x=std: :numeric_limits<float>::quiet_NaN();
      y=std: :numeric_limits<float>::quiet_NaN();
      z=std: :numeric_limits<float>::quiet_NaN();
    }
    buffer.push_back(cv::Vec3f(x, y, z));
  }
  // Create Widget
  cv::Mat cloudMat=cv::Mat(static_cast<int>(buffer.size()), 1, CV_32FC3, &buffer[0]);
  cv::viz::WCloud cloud(cloudMat);
  // Show Point Cloud
  viewer.showWidget("Cloud", cloud);
  viewer.spinOnce();
  // Close All Viewers
  cv::viz::unregisterAllWindows();
  return 0;
}

private: System::Void MyForm_Load(System::Object^ sender, System::EventArgs^ e) {}

private: System::Void button1_Click(System::Object^ sender, System::EventArgs^ e) {
  Display_Point_Cloud();
}


}
;
kav
  • 65
  • 4
  • 10
  • Solutions seeking questions are degraded, please try and showcase your code here, and then ask for help on a problem. – Prasad_Joshi May 29 '18 at 08:47
  • Added my code now. Hope it helps – kav May 29 '18 at 08:58
  • I don't have any knowledge about Lidar, but I did some search and I hope below links can help you. https://www.paraview.org/veloview/ OR https://midas3.kitware.com/midas/community/29 – Prasad_Joshi May 29 '18 at 09:10

1 Answers1

0

Try VTK. https://www.vtk.org/ I use it for my work and it can be compiled with opencv support.

hagor
  • 304
  • 1
  • 15