0

我有这个非常简单的工具,可以使用 Opencv 在线可视化激光雷达传感器数据。我想为它创建一个 GUI,但我是该地区的菜鸟。对材料或示例有什么建议吗?GUI 现在只需要做两件事:

  1. 通过 LAN 端口将传感器数据作为输入。
  2. 可视化它。

这是我根据一些 YouTube 视频得出的结论。我应该如何进行?

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();
}


}
;

4

1 回答 1

0

试试VTK。 https://www.vtk.org/ 我将它用于我的工作,它可以在 opencv 支持下编译。

于 2018-05-29T10:50:05.440 回答