pcl-qt使用QVTKWidget 与PCLVisualizer 显示雷达点云
#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 显示雷达点云的更多相关文章
- PCL+Qt+VS可视化点云
前言 Point Cloud Library (PCL)是一个功能强大的开源C++库,假设可以使用好PCL将会对我们在LiDAR数据处理领域的研究产生巨大帮助.LiDAR技术经过几十年的发展.眼下国内 ...
- pcl计算样点法向并显示
利用最小二乘法估计样点表面法向,并显示 #include <pcl/point_types.h> #include <pcl/io/pcd_io.h> #include < ...
- Qt flash_eraseall nandwrite 进度条显示擦除、烧录
/***************************************************************************** * Qt flash_eraseall n ...
- 使用 Qt 获取 UDP 数据并显示成图片(2)
本文首发于 BriFuture 的 个人博客 在我的前一篇文章 使用 Qt 获取 UDP 数据并显示成图片 中,我讲了如何用 Python 模拟发送数据,如何在 Qt 中高效的接收 UDP 数据包并将 ...
- 解析 Qt 字库移植并能显示中文 (下篇)
原文http://mobile.51cto.com/symbian-272563.htm 本文介绍的是Qt 字库移植并能显示中文,需要的字体库文件,一般是多个.具体移植那一个,看你使用的字库是什么了, ...
- 解析 Qt 字库移植并能显示中文 (上篇)
原文http://mobile.51cto.com/symbian-272552.htm 本文介绍的是Qt 字库移植并能显示中文,需要的字体库文件,一般是多个.具体移植那一个,看你使用的字库是什么了, ...
- 在c++MFC下用PCL显示操作点云文件 MFC对话框显示操作PCL点云
原文作者:aircraft 原文地址:https://www.cnblogs.com/DOMLX/p/13115873.html 第一步 下载PCL库 我的版本是1.8.1的 你都要MFC下跑PCL ...
- Qt 学习之路 :可视化显示数据库数据
前面我们用了两个章节介绍了 Qt 提供的两种操作数据库的方法.显然,使用QSqlQuery的方式更灵活,功能更强大,而使用QSqlTableModel则更简单,更方便与 model/view 结合使用 ...
- Qt on Android:让 Qt Widgets 和 Qt Quick 应用全屏显示
Android 系统版本号非常多,较新的 4.4 ,较老的 2.3 ,都有人用. Qt on Android 开发的 Android 应用.默认在 Android 设备上是非全屏的. 而有些应用的需求 ...
随机推荐
- Non-Maximum Suppression(非极大值抑制)
定义与介绍(NMS 以及soft-NMS也有简单的介绍): https://www.cnblogs.com/makefile/p/nms.html IoU的介绍这篇写的不错: https://oldp ...
- ASP.NET Core在支付宝小程序中使用signalR
Github有一个经过重写的微信小程序SignalR的js类库 https://github.com/liangshiw/SignalRMiniProgram-Client 于是我把他改成支付宝小程序 ...
- Git使用整理
[本文由水木桶首发于博客园,原文地址:https://www.cnblogs.com/shuimutong/p/11404664.html,未接允许,严禁转载] 背景 很久之前使用的是svn,直接在E ...
- DEDECMS标签笔记
注意点: 1.dede的标签不可以嵌套(除了channelartlist里面可以嵌套指定的标签),那么当需要使用{dede:global.cfg_webname/}dede标签的时候我们需要转换成[f ...
- XML 约束
XML约束 一.约束 约束:规定 xml 文档的书写规则 要求: 1.能够在 xml 中引入约束文档 2.能够简单的读懂约束文档 分类: 1.DTD:一种简单的约束技术(后缀.dtd) 2.Schem ...
- sql基本常识[未完待续]
---------------------------------------------------------------------------------------------------- ...
- 浅析MySQL使用 GROUP BY 分组聚合与细分聚合
原创文章,转载请注明出处:http://www.cnblogs.com/weix-l/p/7521278.html: 若有错误,请评论指出,谢谢! 1. 聚合函数(Aggregate Function ...
- 听说你知道什么是锁 --JAVA
I.java中的锁 1.1 什么是锁 在计算机科学中,锁(lock)与互斥(mutex)是一种同步机制,用于在许多线程执行时对资源的限制. 锁通常需要硬件支持才可以有效实施.这种支持通常采用一 ...
- linux下安装grpc插件 (c++和go语言)
在debian/ubuntu系统下,需要做如下准备操作: $ [sudo] apt-get install build-essential autoconf libtool pkg-config 如果 ...
- 使用FastJSON 对Map/JSON/String 进行互转
Fastjson是一个Java语言编写的高性能功能完善的JSON库,由阿里巴巴公司团队开发的主要特性主要体现在以下几个方面: 1.高性能 fastjson采用独创的算法,将parse的速度提升到极致, ...