#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. Luogu4827 Crash的文明世界 组合、树形DP

    传送门 又是喜闻乐见的\(k\)次幂求和题目 那么\(S(x) = \sum\limits_{i=1}^n dist(i,x)^k = \sum\limits_{i=1}^n \sum\limits_ ...

  2. fiddler数据过滤功能

    设置会话过滤的菜单如下图: 1.勾选Use Filters选项表示使用过滤设置,不勾选则不使用 2.Actions:有四个选项 Run Filterset now:立即运行过滤设置: Load Fil ...

  3. kubernetes第三章--创建harbor私有镜像库

  4. 【开发笔记】- Linux命令大全

    系统信息  arch 显示机器的处理器架构(1) uname -m 显示机器的处理器架构(2) uname -r 显示正在使用的内核版本 dmidecode -q 显示硬件系统部件 - (SMBIOS ...

  5. python多进程并发插入mysql数据

    import pymysql import traceback from multiprocessing import Pool,Manager,cpu_count from multiprocess ...

  6. Vue项目中使用svg图标

    svg的图片有着颜色自定义大小自定义的优势.在阿里图标库可以下载svg图片. 那么在vue框架中我们该怎么使用svg图片呢 这个时候就用到了 webpack 插件 svg-sprite-loader ...

  7. win10开启redis失败解决方案

    输入命令:redis-server redis.windows.conf 提示:解决redis无法启动,报错:无法将“redis-server”项识别为 cmdlet.函数.脚本文件或可运行程 序的名 ...

  8. VSCode - Beautify插件配置

    注: 本文摘自 黑火巨雷 - 简书 1. 在工作目录下建立.jsbeautifyrc文件 官方文档 { "brace_style": "none,preserve-inl ...

  9. c# 计算目录的大小

  10. 高并发架构系列:Redis并发竞争key的解决方案详解

    https://blog.csdn.net/ChenRui_yz/article/details/85096418 https://blog.csdn.net/ChenRui_yz/article/l ...