2025-07-23 01:35:14 +08:00
|
|
|
#ifndef POINTCLOUDIMAGEUTILS_H
|
|
|
|
|
#define POINTCLOUDIMAGEUTILS_H
|
|
|
|
|
|
|
|
|
|
#include <QImage>
|
|
|
|
|
#include <QColor>
|
|
|
|
|
#include <vector>
|
2025-09-14 14:51:38 +08:00
|
|
|
|
2025-09-16 00:02:42 +08:00
|
|
|
#include "VZNL_Types.h"
|
2025-09-14 14:51:38 +08:00
|
|
|
#include "SG_baseDataType.h"
|
2025-07-23 01:35:14 +08:00
|
|
|
|
|
|
|
|
class PointCloudImageUtils
|
|
|
|
|
{
|
|
|
|
|
public:
|
2025-09-14 14:51:38 +08:00
|
|
|
// 点云转图像 - 从LapWeldPresenter提取
|
2025-07-23 01:35:14 +08:00
|
|
|
static QImage GeneratePointCloudImage(SVzNL3DLaserLine* scanData,
|
|
|
|
|
int lineNum,
|
|
|
|
|
const std::vector<SSG_peakRgnInfo>& objOps);
|
|
|
|
|
|
|
|
|
|
static QImage GeneratePointCloudImage(SVzNLXYZRGBDLaserLine* scanData,
|
|
|
|
|
int lineNum,
|
|
|
|
|
const std::vector<SSG_peakOrienRgnInfo>& objOps);
|
2025-07-26 01:10:21 +08:00
|
|
|
|
|
|
|
|
// 新的点云图像生成函数 - 基于X、Y范围创建图像
|
2025-09-16 00:02:42 +08:00
|
|
|
static QImage GeneratePointCloudImage(SVzNLXYZRGBDLaserLine* scanData,
|
2025-07-26 01:10:21 +08:00
|
|
|
int lineNum);
|
2025-09-16 00:02:42 +08:00
|
|
|
|
|
|
|
|
// LapWeld点云和检测结果转图像 - 基于scan lines格式
|
|
|
|
|
static QImage GeneratePointCloudImage(const std::vector<std::vector<SVzNL3DPosition>>& scanLines,
|
|
|
|
|
const std::vector<std::vector<SVzNL3DPoint>>& weldResults,
|
|
|
|
|
int imageWidth = 800, int imageHeight = 600);
|
|
|
|
|
|
2025-11-02 16:48:52 +08:00
|
|
|
// Workpiece点云和角点检测结果转图像 - 将角点画成圆点
|
|
|
|
|
static QImage GeneratePointCloudRetPointImage(const std::vector<std::vector<SVzNL3DPosition>>& scanLines,
|
|
|
|
|
const std::vector<std::vector<SVzNL3DPoint>>& cornerPoints);
|
|
|
|
|
|
2025-07-23 01:35:14 +08:00
|
|
|
private:
|
|
|
|
|
// 定义线特征颜色和大小获取函数
|
|
|
|
|
static void GetLineFeatureStyle(int vType, int hType, int objId,
|
|
|
|
|
QColor& pointColor, int& pointSize);
|
|
|
|
|
|
|
|
|
|
// 获取对象颜色
|
|
|
|
|
static QColor GetObjectColor(int index);
|
|
|
|
|
|
|
|
|
|
// 计算点云范围
|
|
|
|
|
static void CalculatePointCloudRange(SVzNL3DLaserLine* scanData, int lineNum,
|
2025-09-16 00:02:42 +08:00
|
|
|
double& xMin, double& xMax,
|
2025-07-23 01:35:14 +08:00
|
|
|
double& yMin, double& yMax);
|
|
|
|
|
|
2025-09-16 00:02:42 +08:00
|
|
|
// 计算scan lines格式点云的范围
|
|
|
|
|
static void CalculateScanLinesRange(const std::vector<std::vector<SVzNL3DPosition>>& scanLines,
|
|
|
|
|
double& xMin, double& xMax,
|
|
|
|
|
double& yMin, double& yMax);
|
|
|
|
|
|
|
|
|
|
// 绘制LapWeld检测结果
|
|
|
|
|
static void DrawLapWeldResults(QPainter& painter,
|
|
|
|
|
const std::vector<std::vector<SVzNL3DPoint>>& weldResults,
|
|
|
|
|
double xMin, double xMax, double yMin, double yMax,
|
|
|
|
|
int imageWidth, int imageHeight);
|
|
|
|
|
|
|
|
|
|
// 绘制scan lines点云数据
|
|
|
|
|
static void DrawScanLinesPointCloud(QPainter& painter,
|
|
|
|
|
const std::vector<std::vector<SVzNL3DPosition>>& scanLines,
|
|
|
|
|
double xMin, double xMax, double yMin, double yMax,
|
|
|
|
|
int imageWidth, int imageHeight);
|
|
|
|
|
|
2025-07-23 01:35:14 +08:00
|
|
|
// 绘制目标检测结果
|
|
|
|
|
static void DrawDetectionTargets(QPainter& painter,
|
|
|
|
|
const std::vector<SSG_peakRgnInfo>& objOps,
|
|
|
|
|
double xMin, double xScale, int xSkip,
|
|
|
|
|
double yMin, double yScale, int ySkip,
|
|
|
|
|
int imgCols, int imgRows);
|
|
|
|
|
|
|
|
|
|
// 绘制目标检测结果
|
|
|
|
|
static void DrawDetectionTargets(QPainter& painter,
|
|
|
|
|
const std::vector<SSG_peakOrienRgnInfo>& objOps,
|
|
|
|
|
double xMin, double xScale, int xSkip,
|
|
|
|
|
double yMin, double yScale, int ySkip,
|
|
|
|
|
int imgCols, int imgRows);
|
|
|
|
|
};
|
|
|
|
|
|
2025-09-16 00:02:42 +08:00
|
|
|
#endif // POINTCLOUDIMAGEUTILS_H
|