97 lines
4.3 KiB
C++
97 lines
4.3 KiB
C++
#ifndef POINTCLOUDIMAGEUTILS_H
|
|
#define POINTCLOUDIMAGEUTILS_H
|
|
|
|
#include <QImage>
|
|
#include <QColor>
|
|
#include <vector>
|
|
|
|
#include "VZNL_Types.h"
|
|
#include "SG_baseDataType.h"
|
|
|
|
// 简单的颗粒信息结构 - 避免依赖OpenCV
|
|
struct SimpleParticleInfo {
|
|
SVzNL3DPoint vertix[8]; // 8个顶点
|
|
struct {
|
|
double width;
|
|
double height;
|
|
} size;
|
|
};
|
|
|
|
class PointCloudImageUtils
|
|
{
|
|
public:
|
|
// 点云转图像 - 从LapWeldPresenter提取
|
|
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);
|
|
|
|
// 新的点云图像生成函数 - 基于X、Y范围创建图像
|
|
static QImage GeneratePointCloudImage(SVzNLXYZRGBDLaserLine* scanData,
|
|
int lineNum);
|
|
|
|
// 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);
|
|
|
|
// Workpiece点云和角点检测结果转图像 - 将角点画成圆点
|
|
static QImage GeneratePointCloudRetPointImage(const std::vector<std::vector<SVzNL3DPosition>>& scanLines,
|
|
const std::vector<std::vector<SVzNL3DPoint>>& cornerPoints);
|
|
|
|
// ParticleSize点云和颗粒检测结果转图像 - 生成带颗粒标记的点云图像 (直接返回QImage)
|
|
static QImage GeneratePointCloudImageWithParticles(
|
|
const std::vector<std::vector<SVzNL3DPosition>>& scanLines,
|
|
const std::vector<SimpleParticleInfo>& particles,
|
|
int cameraIndex);
|
|
|
|
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,
|
|
double& xMin, double& xMax,
|
|
double& yMin, double& yMax);
|
|
|
|
// 计算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);
|
|
|
|
// 绘制目标检测结果
|
|
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);
|
|
};
|
|
|
|
#endif // POINTCLOUDIMAGEUTILS_H
|