#ifndef PCLVIEWER_H
#define PCLVIEWER_H
#include "defines.h"
#include <iostream>
#include "radarserviceprovider.h"
#include "radarserviceprovider32.h"
#include "radarserviceproviderbase.h"
// Qt
#include <QWidget>
#include <QObject>
#include <QTimer> // Point Cloud Library
//#include "pcl/visualization/pcl_visualizer.h"
#include "pcl/pcl_visualizer.h"
#include <vtkRenderWindow.h>
#include<QMutex>
#include<QDialog>
#include "QVTKWidget.h"
class vtkRenderer;
class vtkRenderWindowInteractor;
class vtkImageViewer2;
#define MAX_READ_LENGTH 5000
namespace Ui
{
class PCLViewer;
}; class PCLViewer : public QVTKWidget
{
Q_OBJECT public:
EIGEN_MAKE_ALIGNED_OPERATOR_NEW explicit PCLViewer (QWidget *parent = ,int width =,int height =);
~PCLViewer (); protected:
boost::shared_ptr<pcl::visualization::PCLVisualizer>
m_viewerOrg;
PointCloudT::Ptr m_cloudOrg;
private slots: void combineRadarData(); private: int m_height;
int m_width; PointCloudT m_pOrgData;
PointCloudT m_ptestData;
bool m_frontArrivedFlag; //ǰ�״����ݵ�����ֵ
bool m_backArrivedFlag; // ���״����ݵ�����־ int m_cubeSize;
QStringList m_idList;
QStringList m_idSituationList;
pcl::visualization::Camera m_cam; bool m_viewFollow = true;
QTimer *m_timer;
QMutex m_lidarBackMutex;
QMutex m_lidarfrontMutex;
QMutex m_situationTargetsMutex;
QMutex m_lidarTargetsMutex; }; #endif // PCLVIEWER_H

项目是两个雷达数据一起显示的。

#include "pclviewer.h"
#include <vtkOutputWindow.h>
#include <vtkPolyDataAlgorithm.h>
#include "service.h"
#include <QFile>
#include<QFileDevice>
#include<QXmlStreamReader>
#include"config.h"
#include "src/datacache.h"
#include<QMessageBox>
#include "service.h"
#include<QMutexLocker>
#include"math.h"
#include "vtkRenderer.h"
#include "vtkRenderWindowInteractor.h"
#include "vtkConeSource.h" #include <vtkImageViewer2.h>
#include <vtkPNGReader.h> #define MAX_POINT_NUM 1
PCLViewer::PCLViewer (QWidget *parent, int width, int height) :
QVTKWidget(parent),m_frontArrivedFlag(false),m_backArrivedFlag(false),
m_width(width),m_height(height)
{
qDebug()<<"width:height"<<width<<":"<<height;
this->setFixedSize(width,height);
m_cubeSize =0; vtkOutputWindow::SetGlobalWarningDisplay(0);
m_cloudOrg.reset(new PointCloudT);
m_cloudOrg->points.resize(MAX_POINT_NUM);
m_viewerOrg.reset (new pcl::visualization::PCLVisualizer ("viewer", false));
this->SetRenderWindow (m_viewerOrg->getRenderWindow ());
m_viewerOrg->setupInteractor (this->GetInteractor (), this->GetRenderWindow ()); m_viewerOrg->resetCamera(); m_viewerOrg->addPointCloud (m_cloudOrg, "cloud"); m_viewerOrg->setCameraPosition(0, 0, 72, 0, 1, 0, 0); std::vector<pcl::visualization::Camera> cam;
m_viewerOrg->getCameras(cam);
m_cam =cam[0]; } void PCLViewer::combineRadarData()
{
if(m_viewFollow)
{
float offsetx = 视觉x坐标 ;
float offsety = 视觉y坐标; m_cam.pos[0] = offsetx;
m_cam.pos[1]= offsety;
m_cam.pos[2]=72;
m_cam.focal[0] = offsetx;
m_cam.focal[1]= offsety;
m_cam.focal[2]=0;
m_cam.view[0]=0;
m_cam.view[1]=1;
m_cam.view[2]=0;
m_viewerOrg->setCameraParameters(m_cam);
} if(m_threadList.count()>0) // m_threadList接收线程列表
{
PointCloudT::Ptr data =m_threadList.at(0)->readData();
PointCloudT combine = *data;
for(int i =1;i<m_threadList.count();i++ )
{
PointCloudT::Ptr backData = m_threadList.at(i)->readData() ;
combine += *backData;
}
PointCloudT::Ptr pCombine = combine.makeShared();
m_viewerOrg->updatePointCloud(pCombine, "cloud");
this->update();
} for(auto p: m_threadList)
{
p->setDataUsed();
} }

  

最新文章

  1. 吉特仓库管理系统- 斑马打印机 ZPL语言的腐朽和神奇
  2. [zhuan] linux 下 wxWidgets 安装,编译
  3. android权限permission大全
  4. Ubuntu升级内核
  5. 如何解决jQuery Validation针对动态添加的表单无法工作的问题?
  6. 用aauto做游戏修改器
  7. git终端提示符
  8. Eclipse设置、问题解决方案
  9. bzoj 1879 [Sdoi2009]Bill的挑战(状压DP)
  10. 预载入和JavaScript Image()对象
  11. TCO之旅
  12. testng生成自定义html报告
  13. ASP.NET 创建WebService——简单例子
  14. myeclipse连接mysql生成数据表时中文字符乱码或问号(解决方法)
  15. 一个C++右值引用的问题
  16. 在文件保存中 os.getcwd() os.listdir() os.makedirs() os.mkdir() xx.join() ... 等函数 的使用介绍
  17. mysql中FIND_IN_SET函数的使用
  18. CSS3 GPU硬件加速
  19. 某线下赛AWD
  20. SpringBoot 玩转读写分离

热门文章

  1. System.ComponentModel.Win32Exception (0x80004005): 无效的窗口句柄。
  2. matlab安装与使用
  3. DevExtreme学习笔记(一) DataGrid中数据筛选
  4. 使用交叉验证法(Cross Validation)进行模型评估
  5. String字符串常用方法
  6. flutter isolate demo
  7. MySQL连接使用
  8. Android 低功耗蓝牙BLE 开发注意事项
  9. SSH框架笔记01_SSH整合的两种方式
  10. Javascript诞生记 [转载]