feat: 添加点云着色按钮 适配调整后的下位机图像采集方式
This commit is contained in:
@@ -23,6 +23,8 @@ public:
|
||||
~PointCloudGLWidget();
|
||||
|
||||
void updatePointCloud(pcl::PointCloud<pcl::PointXYZ>::Ptr cloud);
|
||||
void setColorMode(bool enabled) { m_colorMode = enabled ? 1 : 0; update(); }
|
||||
bool colorMode() const { return m_colorMode != 0; }
|
||||
|
||||
protected:
|
||||
void initializeGL() override;
|
||||
@@ -48,25 +50,31 @@ private:
|
||||
// 点云数据
|
||||
std::vector<float> m_vertices;
|
||||
int m_pointCount;
|
||||
|
||||
// 固定的点云中心点(避免抖动)
|
||||
QVector3D m_fixedCenter;
|
||||
bool m_centerInitialized;
|
||||
float m_minZ, m_maxZ; // 深度范围(用于着色)
|
||||
|
||||
// 相机参数
|
||||
QMatrix4x4 m_projection;
|
||||
QMatrix4x4 m_view;
|
||||
QMatrix4x4 m_model;
|
||||
|
||||
float m_orthoSize; // 正交投影视野大小(控制缩放)
|
||||
float m_fov; // 透视投影视场角
|
||||
float m_rotationX; // X轴旋转角度
|
||||
float m_rotationY; // Y轴旋转角度
|
||||
QVector3D m_translation; // 平移
|
||||
QVector3D m_cloudCenter; // 点云中心
|
||||
float m_viewDistance; // 观察距离
|
||||
QVector3D m_panOffset; // 用户平移偏移
|
||||
float m_zoom; // 缩放因子
|
||||
|
||||
// 鼠标交互状态
|
||||
QPoint m_lastMousePos;
|
||||
bool m_leftButtonPressed;
|
||||
bool m_rightButtonPressed;
|
||||
|
||||
// 首帧标志(只在首帧时自动居中)
|
||||
bool m_firstFrame;
|
||||
|
||||
// 颜色模式(0=黑白,1=彩色)
|
||||
int m_colorMode;
|
||||
};
|
||||
|
||||
#endif // POINTCLOUDGLWIDGET_H
|
||||
|
||||
@@ -19,6 +19,10 @@ public:
|
||||
// 更新点云显示
|
||||
void updatePointCloud(pcl::PointCloud<pcl::PointXYZ>::Ptr cloud);
|
||||
|
||||
// 颜色模式控制
|
||||
void setColorMode(bool enabled);
|
||||
bool colorMode() const;
|
||||
|
||||
private:
|
||||
QLabel *m_statusLabel;
|
||||
PointCloudGLWidget *m_glWidget;
|
||||
|
||||
Reference in New Issue
Block a user