feat: 添加点云去噪及其参数调整
This commit is contained in:
@@ -1,8 +1,10 @@
|
||||
#ifndef POINTCLOUDPROCESSOR_H
|
||||
#ifndef POINTCLOUDPROCESSOR_H
|
||||
#define POINTCLOUDPROCESSOR_H
|
||||
|
||||
#include <QObject>
|
||||
#include <QByteArray>
|
||||
#include <atomic>
|
||||
#include <mutex>
|
||||
#include <pcl/point_cloud.h>
|
||||
#include <pcl/point_types.h>
|
||||
#include <CL/cl.h>
|
||||
@@ -15,44 +17,38 @@ public:
|
||||
explicit PointCloudProcessor(QObject *parent = nullptr);
|
||||
~PointCloudProcessor();
|
||||
|
||||
// 初始化OpenCL
|
||||
bool initializeOpenCL();
|
||||
|
||||
// 设置相机内参
|
||||
void setCameraIntrinsics(float fx, float fy, float cx, float cy);
|
||||
|
||||
// 设置Z缩放因子
|
||||
void setZScaleFactor(float scale);
|
||||
|
||||
// 将深度数据转换为点云(使用OpenCL GPU加速)
|
||||
void processDepthData(const QByteArray &depthData, uint32_t blockId);
|
||||
|
||||
// 处理已经计算好的点云数据(x,y,z格式)
|
||||
void processPointCloudData(const QByteArray &cloudData, uint32_t blockId);
|
||||
|
||||
void setDenoiseEnabled(bool enabled);
|
||||
void setDenoiseNeighborSupport(int minNeighbors);
|
||||
void setDenoiseLowTailPermille(int permille);
|
||||
void setDenoiseDepthBandPermille(int permille);
|
||||
|
||||
signals:
|
||||
void pointCloudReady(pcl::PointCloud<pcl::PointXYZ>::Ptr cloud, uint32_t blockId);
|
||||
void errorOccurred(const QString &error);
|
||||
|
||||
private:
|
||||
// 清理OpenCL资源
|
||||
pcl::PointCloud<pcl::PointXYZ>::Ptr applyDenoise(const pcl::PointCloud<pcl::PointXYZ>::Ptr &input);
|
||||
void loadLowerCalibration();
|
||||
void cleanupOpenCL();
|
||||
|
||||
// 相机内参
|
||||
float m_fx;
|
||||
float m_fy;
|
||||
float m_cx;
|
||||
float m_cy;
|
||||
|
||||
// Z缩放因子
|
||||
float m_zScale;
|
||||
|
||||
// 图像尺寸
|
||||
int m_imageWidth;
|
||||
int m_imageHeight;
|
||||
int m_totalPoints;
|
||||
|
||||
// OpenCL资源
|
||||
cl_platform_id m_platform;
|
||||
cl_device_id m_device;
|
||||
cl_context m_context;
|
||||
@@ -62,6 +58,30 @@ private:
|
||||
cl_mem m_depthBuffer;
|
||||
cl_mem m_xyzBuffer;
|
||||
bool m_clInitialized;
|
||||
|
||||
std::atomic_bool m_denoiseEnabled;
|
||||
float m_voxelLeafSize;
|
||||
std::atomic_int m_denoiseNeighborSupport;
|
||||
std::atomic_int m_denoiseLowTailPermille;
|
||||
std::atomic_int m_denoiseDepthBandPermille;
|
||||
|
||||
// Calibration params aligned with lower-machine model
|
||||
float m_k1;
|
||||
float m_k2;
|
||||
float m_p1;
|
||||
float m_p2;
|
||||
float m_p5;
|
||||
float m_p6;
|
||||
float m_p7;
|
||||
float m_p8;
|
||||
bool m_hasLowerCalibration;
|
||||
|
||||
// Temporal stabilizers for denoise to reduce frame-to-frame flicker.
|
||||
std::mutex m_denoiseStateMutex;
|
||||
bool m_hasAnchorMeanZ;
|
||||
float m_anchorMeanZFiltered;
|
||||
bool m_hasLowCutZ;
|
||||
float m_lowCutZFiltered;
|
||||
};
|
||||
|
||||
#endif // POINTCLOUDPROCESSOR_H
|
||||
|
||||
Reference in New Issue
Block a user