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

  

pcl-qt使用QVTKWidget 与PCLVisualizer 显示雷达点云的更多相关文章

  1. PCL+Qt+VS可视化点云

    前言 Point Cloud Library (PCL)是一个功能强大的开源C++库,假设可以使用好PCL将会对我们在LiDAR数据处理领域的研究产生巨大帮助.LiDAR技术经过几十年的发展.眼下国内 ...

  2. pcl计算样点法向并显示

    利用最小二乘法估计样点表面法向,并显示 #include <pcl/point_types.h> #include <pcl/io/pcd_io.h> #include < ...

  3. Qt flash_eraseall nandwrite 进度条显示擦除、烧录

    /***************************************************************************** * Qt flash_eraseall n ...

  4. 使用 Qt 获取 UDP 数据并显示成图片(2)

    本文首发于 BriFuture 的 个人博客 在我的前一篇文章 使用 Qt 获取 UDP 数据并显示成图片 中,我讲了如何用 Python 模拟发送数据,如何在 Qt 中高效的接收 UDP 数据包并将 ...

  5. 解析 Qt 字库移植并能显示中文 (下篇)

    原文http://mobile.51cto.com/symbian-272563.htm 本文介绍的是Qt 字库移植并能显示中文,需要的字体库文件,一般是多个.具体移植那一个,看你使用的字库是什么了, ...

  6. 解析 Qt 字库移植并能显示中文 (上篇)

    原文http://mobile.51cto.com/symbian-272552.htm 本文介绍的是Qt 字库移植并能显示中文,需要的字体库文件,一般是多个.具体移植那一个,看你使用的字库是什么了, ...

  7. 在c++MFC下用PCL显示操作点云文件 MFC对话框显示操作PCL点云

    原文作者:aircraft 原文地址:https://www.cnblogs.com/DOMLX/p/13115873.html 第一步 下载PCL库  我的版本是1.8.1的 你都要MFC下跑PCL ...

  8. Qt 学习之路 :可视化显示数据库数据

    前面我们用了两个章节介绍了 Qt 提供的两种操作数据库的方法.显然,使用QSqlQuery的方式更灵活,功能更强大,而使用QSqlTableModel则更简单,更方便与 model/view 结合使用 ...

  9. Qt on Android:让 Qt Widgets 和 Qt Quick 应用全屏显示

    Android 系统版本号非常多,较新的 4.4 ,较老的 2.3 ,都有人用. Qt on Android 开发的 Android 应用.默认在 Android 设备上是非全屏的. 而有些应用的需求 ...

随机推荐

  1. 聊一聊,React开发中应该规避的点

    原文永久链接: https://github.com/AttemptWeb..... 下面说到的React开发中注意的问题,部分是自己遇到过的点,部分是收集的,也算是React代码优化部分,这次做一个 ...

  2. 【洛谷 P3224】 [HNOI2012]永无乡(Splay,启发式合并)

    题目链接 启发式合并就是暴力合并把小的合并到大的里,一个一个插进去. 并查集维护连通性,同时保证并查集的根就是所在Splay的根,这样能省去很多操作. #include <cstdio> ...

  3. 深入理解TCP三握四挥

    面试中被问到不少次TCP的三握四挥,今天特意来做一个总结(一些资料是很久前找的,忘了参考的链接了) 一.三次握手 首先来看一张图 最初,客户机A与服务器B的TCP进程都处于 CLOSED 状态. 然后 ...

  4. 【转载】 C#中List集合使用First()方法获取第一个元素

    在C#的List集合操作过程中,如果要获取List集合中的第一个元素对象,则一般会先通过获取到list[0]这种方式来获取第一个元素.其实在List集合中提供了获取最后一个元素的First()方法,调 ...

  5. npm/svn 命令

    npm npm config set registry https://registry.npm.taobao.org npm config list svn + 清除失败的事务 - cmd管理员运行 ...

  6. Django:web认识,jinja2模块,如何安装Django

    一内容概要 1.HTTP协议 1.1简介 ​ 超文本传输协议(英文:Hyper Text Transfer Protocol,HTTP)是一种用于分布式.协作式和超媒体信息系统的应用层协议.HTTP是 ...

  7. day35-python之协程

    1.协程 # import time # import queue # # def consumer(name): # # print("--->ready to eat baozi. ...

  8. Android著名开源库

    UI方面 1.绘制图表MPAndroidChart.hellocharts: https://github.com/PhilJay/MPAndroidChart https://github.com/ ...

  9. java web编程 servlet3

     

  10. MySQL Binlog--事务日志和BINLOG落盘参数对磁盘IO的影响

    参数说明 innodb_flush_log_at_trx_commit和sync_binlog 两个参数是控制MySQL 磁盘写入策略以及数据安全性的关键参数,不同参数设置对磁盘IO影响不同. 参数i ...