孔检测更新算法
This commit is contained in:
parent
807df6c110
commit
7725f9ce8d
@ -205,14 +205,15 @@ int HoleDetectionPresenter::InitAlgoParams()
|
|||||||
|
|
||||||
const VrAlgorithmParams& xmlParams = configResult.algorithmParams;
|
const VrAlgorithmParams& xmlParams = configResult.algorithmParams;
|
||||||
|
|
||||||
LOG_INFO("Loaded XML params - Ransac: distanceThreshold=%.2f, maxIterations=%d, minPlanePoints=%d, maxPlanes=%d, growthZThreshold=%.2f, minPlaneRatio=%.2f, maxNormalAngleDeg=%.1f\n",
|
LOG_INFO("Loaded XML params - Ransac: distanceThreshold=%.2f, maxIterations=%d, minPlanePoints=%d, maxPlanes=%d, growthZThreshold=%.2f, minPlaneRatio=%.2f, maxNormalAngleDeg=%.1f, maxDistFromPlane=%.2f\n",
|
||||||
xmlParams.ransacParam.distanceThreshold,
|
xmlParams.ransacParam.distanceThreshold,
|
||||||
xmlParams.ransacParam.maxIterations,
|
xmlParams.ransacParam.maxIterations,
|
||||||
xmlParams.ransacParam.minPlanePoints,
|
xmlParams.ransacParam.minPlanePoints,
|
||||||
xmlParams.ransacParam.maxPlanes,
|
xmlParams.ransacParam.maxPlanes,
|
||||||
xmlParams.ransacParam.growthZThreshold,
|
xmlParams.ransacParam.growthZThreshold,
|
||||||
xmlParams.ransacParam.minPlaneRatio,
|
xmlParams.ransacParam.minPlaneRatio,
|
||||||
xmlParams.ransacParam.maxNormalAngleDeg);
|
xmlParams.ransacParam.maxNormalAngleDeg,
|
||||||
|
xmlParams.ransacParam.maxDistFromPlane);
|
||||||
|
|
||||||
LOG_INFO("Loaded XML params - Detection: angleThresholdPos=%.1f, angleThresholdNeg=%.1f, angleSearchDistance=%.2f, minPitDepth=%.2f\n",
|
LOG_INFO("Loaded XML params - Detection: angleThresholdPos=%.1f, angleThresholdNeg=%.1f, angleSearchDistance=%.2f, minPitDepth=%.2f\n",
|
||||||
xmlParams.detectionParam.angleThresholdPos,
|
xmlParams.detectionParam.angleThresholdPos,
|
||||||
|
|||||||
@ -5,7 +5,7 @@
|
|||||||
#define HOLEDETECTION_APP_NAME "孔洞检测"
|
#define HOLEDETECTION_APP_NAME "孔洞检测"
|
||||||
|
|
||||||
// 版本字符串
|
// 版本字符串
|
||||||
#define HOLEDETECTION_VERSION_STRING "1.1.5"
|
#define HOLEDETECTION_VERSION_STRING "1.1.6"
|
||||||
#define HOLEDETECTION_BUILD_STRING "1"
|
#define HOLEDETECTION_BUILD_STRING "1"
|
||||||
#define HOLEDETECTION_FULL_VERSION_STRING "V" HOLEDETECTION_VERSION_STRING "_" HOLEDETECTION_BUILD_STRING
|
#define HOLEDETECTION_FULL_VERSION_STRING "V" HOLEDETECTION_VERSION_STRING "_" HOLEDETECTION_BUILD_STRING
|
||||||
|
|
||||||
|
|||||||
@ -1,3 +1,7 @@
|
|||||||
|
## 1.1.6 2026-04-07
|
||||||
|
* build_1
|
||||||
|
1. 更新算法 1.0.3
|
||||||
|
|
||||||
## 1.1.5 2026-04-05
|
## 1.1.5 2026-04-05
|
||||||
* build_1
|
* build_1
|
||||||
1. 更新算法 1.0.2
|
1. 更新算法 1.0.2
|
||||||
|
|||||||
@ -301,6 +301,7 @@ void DialogAlgoarg::LoadRansacParamToUI(const VrRansacPlaneSegmentationParam& pa
|
|||||||
ui->lineEdit_growthZThreshold->setText(QString::number(param.growthZThreshold));
|
ui->lineEdit_growthZThreshold->setText(QString::number(param.growthZThreshold));
|
||||||
ui->lineEdit_minPlaneRatio->setText(QString::number(param.minPlaneRatio));
|
ui->lineEdit_minPlaneRatio->setText(QString::number(param.minPlaneRatio));
|
||||||
ui->lineEdit_maxNormalAngleDeg->setText(QString::number(param.maxNormalAngleDeg));
|
ui->lineEdit_maxNormalAngleDeg->setText(QString::number(param.maxNormalAngleDeg));
|
||||||
|
ui->lineEdit_maxDistFromPlane->setText(QString::number(param.maxDistFromPlane));
|
||||||
}
|
}
|
||||||
|
|
||||||
void DialogAlgoarg::LoadDetectionParamToUI(const VrHoleDetectionParam& param)
|
void DialogAlgoarg::LoadDetectionParamToUI(const VrHoleDetectionParam& param)
|
||||||
@ -381,6 +382,9 @@ bool DialogAlgoarg::SaveRansacParamFromUI(VrRansacPlaneSegmentationParam& param)
|
|||||||
param.maxNormalAngleDeg = ui->lineEdit_maxNormalAngleDeg->text().toDouble(&ok);
|
param.maxNormalAngleDeg = ui->lineEdit_maxNormalAngleDeg->text().toDouble(&ok);
|
||||||
if (!ok) return false;
|
if (!ok) return false;
|
||||||
|
|
||||||
|
param.maxDistFromPlane = ui->lineEdit_maxDistFromPlane->text().toDouble(&ok);
|
||||||
|
if (!ok) return false;
|
||||||
|
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@ -7,7 +7,7 @@
|
|||||||
<x>0</x>
|
<x>0</x>
|
||||||
<y>0</y>
|
<y>0</y>
|
||||||
<width>920</width>
|
<width>920</width>
|
||||||
<height>584</height>
|
<height>613</height>
|
||||||
</rect>
|
</rect>
|
||||||
</property>
|
</property>
|
||||||
<property name="windowTitle">
|
<property name="windowTitle">
|
||||||
@ -84,7 +84,7 @@ QScrollArea { border: none; }</string>
|
|||||||
<x>0</x>
|
<x>0</x>
|
||||||
<y>0</y>
|
<y>0</y>
|
||||||
<width>860</width>
|
<width>860</width>
|
||||||
<height>412</height>
|
<height>441</height>
|
||||||
</rect>
|
</rect>
|
||||||
</property>
|
</property>
|
||||||
<layout class="QVBoxLayout" name="verticalLayout_ransac">
|
<layout class="QVBoxLayout" name="verticalLayout_ransac">
|
||||||
@ -178,6 +178,16 @@ QScrollArea { border: none; }</string>
|
|||||||
<item row="6" column="1">
|
<item row="6" column="1">
|
||||||
<widget class="QLineEdit" name="lineEdit_maxNormalAngleDeg"/>
|
<widget class="QLineEdit" name="lineEdit_maxNormalAngleDeg"/>
|
||||||
</item>
|
</item>
|
||||||
|
<item row="7" column="0">
|
||||||
|
<widget class="QLabel" name="label_maxDistFromPlane">
|
||||||
|
<property name="text">
|
||||||
|
<string>点到平面最大允许距离 (mm):</string>
|
||||||
|
</property>
|
||||||
|
</widget>
|
||||||
|
</item>
|
||||||
|
<item row="7" column="1">
|
||||||
|
<widget class="QLineEdit" name="lineEdit_maxDistFromPlane"/>
|
||||||
|
</item>
|
||||||
</layout>
|
</layout>
|
||||||
</widget>
|
</widget>
|
||||||
</item>
|
</item>
|
||||||
@ -216,7 +226,7 @@ QScrollArea { border: none; }</string>
|
|||||||
<x>0</x>
|
<x>0</x>
|
||||||
<y>0</y>
|
<y>0</y>
|
||||||
<width>860</width>
|
<width>860</width>
|
||||||
<height>412</height>
|
<height>441</height>
|
||||||
</rect>
|
</rect>
|
||||||
</property>
|
</property>
|
||||||
<layout class="QVBoxLayout" name="verticalLayout_detection">
|
<layout class="QVBoxLayout" name="verticalLayout_detection">
|
||||||
@ -435,7 +445,7 @@ QScrollArea { border: none; }</string>
|
|||||||
<x>0</x>
|
<x>0</x>
|
||||||
<y>0</y>
|
<y>0</y>
|
||||||
<width>860</width>
|
<width>860</width>
|
||||||
<height>412</height>
|
<height>441</height>
|
||||||
</rect>
|
</rect>
|
||||||
</property>
|
</property>
|
||||||
<layout class="QVBoxLayout" name="verticalLayout_filter">
|
<layout class="QVBoxLayout" name="verticalLayout_filter">
|
||||||
|
|||||||
@ -1,121 +1,91 @@
|
|||||||
#ifndef IVRCONFIG_H
|
#ifndef IVRCONFIG_H
|
||||||
#define IVRCONFIG_H
|
#define IVRCONFIG_H
|
||||||
|
|
||||||
#include <iostream>
|
|
||||||
#include <string>
|
|
||||||
#include <vector>
|
|
||||||
#include <utility>
|
|
||||||
#include <algorithm>
|
#include <algorithm>
|
||||||
#include <cstring>
|
#include <cstring>
|
||||||
|
#include <iostream>
|
||||||
|
#include <string>
|
||||||
|
#include <utility>
|
||||||
|
#include <vector>
|
||||||
|
|
||||||
// 包含公共配置结构体
|
|
||||||
#include "VrCommonConfig.h"
|
#include "VrCommonConfig.h"
|
||||||
#include "VrHandEyeCalibConfig.h"
|
#include "VrHandEyeCalibConfig.h"
|
||||||
|
|
||||||
/**
|
|
||||||
* @brief RANSAC 平面分割参数(映射 RansacPlaneSegmentationParams)
|
|
||||||
*/
|
|
||||||
struct VrRansacPlaneSegmentationParam
|
struct VrRansacPlaneSegmentationParam
|
||||||
{
|
{
|
||||||
double distanceThreshold = 0.5; // 点到平面距离阈值(mm)
|
double distanceThreshold = 0.5;
|
||||||
int maxIterations = 500; // RANSAC 最大迭代次数
|
int maxIterations = 500;
|
||||||
int minPlanePoints = 100; // 最小平面点数
|
int minPlanePoints = 100;
|
||||||
int maxPlanes = 5; // 最大提取平面数量
|
int maxPlanes = 5;
|
||||||
double growthZThreshold = 1.0; // 区域生长时相邻点 Z 差阈值(mm)
|
double growthZThreshold = 1.0;
|
||||||
double minPlaneRatio = 0.1; // 平面最小点数占比
|
double minPlaneRatio = 0.1;
|
||||||
double maxNormalAngleDeg = 30.0; // 平面法向量与Z轴最大夹角(度),<=0 表示不过滤
|
double maxNormalAngleDeg = 30.0;
|
||||||
|
double maxDistFromPlane = 1.0;
|
||||||
};
|
};
|
||||||
|
|
||||||
/**
|
|
||||||
* @brief 孔洞检测参数(映射 SHoleDetectionParams)
|
|
||||||
*/
|
|
||||||
struct VrHoleDetectionParam
|
struct VrHoleDetectionParam
|
||||||
{
|
{
|
||||||
double angleThresholdPos = 50.0; // 正角度阈值(度)
|
double angleThresholdPos = 50.0;
|
||||||
double angleThresholdNeg = -50.0; // 负角度阈值(度)
|
double angleThresholdNeg = -50.0;
|
||||||
double angleSearchDistance = 2.0; // 前后搜索距离 A(mm)
|
double angleSearchDistance = 2.0;
|
||||||
double minPitDepth = 1.0; // 最小凹坑深度(mm)
|
double minPitDepth = 1.0;
|
||||||
double minRadius = 2.0; // 最小孔半径(mm)
|
double minRadius = 2.0;
|
||||||
double maxRadius = 50.0; // 最大孔半径(mm)
|
double maxRadius = 50.0;
|
||||||
int expansionSize1 = 5; // 第一环扩展大小
|
int expansionSize1 = 5;
|
||||||
int expansionSize2 = 10; // 第二环扩展大小
|
int expansionSize2 = 10;
|
||||||
int minVTransitionPoints = 1; // V 形端点间最小有效过渡点数
|
int minVTransitionPoints = 1;
|
||||||
double jumpThresholdResidual = 0.0; // 相邻有效点残差跳变阈值
|
double jumpThresholdResidual = 0.0;
|
||||||
double gapJumpThresholdResidual = 0.0; // 跨无效点间隙残差跳变阈值
|
double gapJumpThresholdResidual = 0.0;
|
||||||
int maxGapPointsInLine = 12; // 允许跨越的最大无效点数
|
int maxGapPointsInLine = 12;
|
||||||
double minFeatureSpan = 2.0; // 特征点对最小弧长跨度(mm)
|
double minFeatureSpan = 2.0;
|
||||||
int residualSmoothWindow = 5; // 残差平滑窗口
|
int residualSmoothWindow = 5;
|
||||||
double slopeAngleThreshold = 3.0; // 坡度补充判断阈值(度)
|
double slopeAngleThreshold = 3.0;
|
||||||
double edgeBoundaryFilterDist = 0.0; // 边缘过滤距离(mm)
|
double edgeBoundaryFilterDist = 0.0;
|
||||||
};
|
};
|
||||||
|
|
||||||
/**
|
|
||||||
* @brief 孔洞过滤参数(映射 SHoleFilterParams)
|
|
||||||
*/
|
|
||||||
struct VrHoleFilterParam
|
struct VrHoleFilterParam
|
||||||
{
|
{
|
||||||
double maxEccentricity = 0.99995; // 最大离心率
|
double maxEccentricity = 0.99995;
|
||||||
double minAngularCoverage = 10.0; // 最小角度覆盖(度)
|
double minAngularCoverage = 10.0;
|
||||||
double maxRadiusFitRatio = 1.0; // 最大半径拟合比率
|
double maxRadiusFitRatio = 1.0;
|
||||||
double minQualityScore = 0.0; // 最小质量分数
|
double minQualityScore = 0.0;
|
||||||
double maxPlaneResidual = 10.0; // 最大平面残差(mm)
|
double maxPlaneResidual = 10.0;
|
||||||
double maxAngularGap = 90.0; // 最大角度间隙(度)
|
double maxAngularGap = 90.0;
|
||||||
double minInlierRatio = 0.0; // 最小内点比率
|
double minInlierRatio = 0.0;
|
||||||
double minHoleDepth = 2.5; // 最小孔深(mm)
|
double minHoleDepth = 2.5;
|
||||||
};
|
};
|
||||||
|
|
||||||
/**
|
|
||||||
* @brief 孔洞排序模式枚举(映射 ESortMode)
|
|
||||||
*/
|
|
||||||
enum VrHoleSortMode
|
enum VrHoleSortMode
|
||||||
{
|
{
|
||||||
HOLE_SORT_NONE = 0, // 不排序
|
HOLE_SORT_NONE = 0,
|
||||||
HOLE_SORT_BY_RADIUS = 1, // 按半径排序(最大优先)
|
HOLE_SORT_BY_RADIUS = 1,
|
||||||
HOLE_SORT_BY_DEPTH = 2, // 按深度排序(最深优先)
|
HOLE_SORT_BY_DEPTH = 2,
|
||||||
HOLE_SORT_BY_QUALITY = 3 // 按质量分数排序(最高优先)
|
HOLE_SORT_BY_QUALITY = 3
|
||||||
};
|
};
|
||||||
|
|
||||||
/**
|
|
||||||
* @brief 姿态输出顺序枚举
|
|
||||||
*
|
|
||||||
* 定义机械臂姿态数据的输出顺序
|
|
||||||
*/
|
|
||||||
enum VrPoseOutputOrder
|
enum VrPoseOutputOrder
|
||||||
{
|
{
|
||||||
POSE_ORDER_RPY = 0, // Roll, Pitch, Yaw(默认)
|
POSE_ORDER_RPY = 0,
|
||||||
POSE_ORDER_RYP = 1, // Roll, Yaw, Pitch
|
POSE_ORDER_RYP = 1,
|
||||||
POSE_ORDER_PRY = 2, // Pitch, Roll, Yaw
|
POSE_ORDER_PRY = 2,
|
||||||
POSE_ORDER_PYR = 3, // Pitch, Yaw, Roll
|
POSE_ORDER_PYR = 3,
|
||||||
POSE_ORDER_YRP = 4, // Yaw, Roll, Pitch
|
POSE_ORDER_YRP = 4,
|
||||||
POSE_ORDER_YPR = 5 // Yaw, Pitch, Roll
|
POSE_ORDER_YPR = 5
|
||||||
};
|
};
|
||||||
|
|
||||||
/**
|
|
||||||
* @brief 方向向量反向配置枚举
|
|
||||||
*
|
|
||||||
* 定义机械臂方向向量的反向配置
|
|
||||||
* 用于调整相机坐标系到机械臂坐标系的方向向量转换
|
|
||||||
*/
|
|
||||||
enum VrDirVectorInvert
|
enum VrDirVectorInvert
|
||||||
{
|
{
|
||||||
DIR_INVERT_NONE = 0, // 不反向
|
DIR_INVERT_NONE = 0,
|
||||||
DIR_INVERT_XY = 1, // X 和 Y 方向反向
|
DIR_INVERT_XY = 1,
|
||||||
DIR_INVERT_XZ = 2, // X 和 Z 方向反向
|
DIR_INVERT_XZ = 2,
|
||||||
DIR_INVERT_YZ = 3 // Y 和 Z 方向反向(默认,兼容原有行为)
|
DIR_INVERT_YZ = 3
|
||||||
};
|
};
|
||||||
|
|
||||||
/**
|
|
||||||
* @brief TCP 协议和坐标输出配置
|
|
||||||
*
|
|
||||||
* 默认值参考 Doc/porotol.jpg 协议文档:
|
|
||||||
* - 汇川 PLC-easy320: 192.168.0.88:502
|
|
||||||
* - 配天机械臂: 192.168.0.90:502
|
|
||||||
*/
|
|
||||||
struct VrPlcRobotServerConfig
|
struct VrPlcRobotServerConfig
|
||||||
{
|
{
|
||||||
int tcpServerPort = 7800; // TCP 协议服务端口
|
int tcpServerPort = 7800;
|
||||||
int poseOutputOrder = POSE_ORDER_RPY; // 姿态输出顺序,默认 RPY
|
int poseOutputOrder = POSE_ORDER_RPY;
|
||||||
int dirVectorInvert = DIR_INVERT_YZ; // 方向向量反向配置,默认 YZ 反向
|
int dirVectorInvert = DIR_INVERT_YZ;
|
||||||
|
|
||||||
VrPlcRobotServerConfig& operator=(const VrPlcRobotServerConfig& other) {
|
VrPlcRobotServerConfig& operator=(const VrPlcRobotServerConfig& other) {
|
||||||
if (this != &other) {
|
if (this != &other) {
|
||||||
@ -135,16 +105,13 @@ struct VrPlcRobotServerConfig
|
|||||||
VrPlcRobotServerConfig() = default;
|
VrPlcRobotServerConfig() = default;
|
||||||
};
|
};
|
||||||
|
|
||||||
/**
|
|
||||||
* @brief 算法参数配置结构
|
|
||||||
*/
|
|
||||||
struct VrAlgorithmParams
|
struct VrAlgorithmParams
|
||||||
{
|
{
|
||||||
VrRansacPlaneSegmentationParam ransacParam; // RANSAC 平面分割参数
|
VrRansacPlaneSegmentationParam ransacParam;
|
||||||
VrHoleDetectionParam detectionParam;// 孔洞检测参数
|
VrHoleDetectionParam detectionParam;
|
||||||
VrHoleFilterParam filterParam; // 孔洞过滤参数
|
VrHoleFilterParam filterParam;
|
||||||
int sortMode = HOLE_SORT_NONE; // 排序模式
|
int sortMode = HOLE_SORT_NONE;
|
||||||
VrPlaneCalibParam planeCalibParam; // 平面校准参数
|
VrPlaneCalibParam planeCalibParam;
|
||||||
|
|
||||||
VrAlgorithmParams& operator=(const VrAlgorithmParams& other) {
|
VrAlgorithmParams& operator=(const VrAlgorithmParams& other) {
|
||||||
if (this != &other) {
|
if (this != &other) {
|
||||||
@ -168,18 +135,15 @@ struct VrAlgorithmParams
|
|||||||
VrAlgorithmParams() = default;
|
VrAlgorithmParams() = default;
|
||||||
};
|
};
|
||||||
|
|
||||||
/**
|
|
||||||
* @brief 配置加载结果
|
|
||||||
*/
|
|
||||||
struct ConfigResult
|
struct ConfigResult
|
||||||
{
|
{
|
||||||
std::vector<DeviceInfo> cameraList;
|
std::vector<DeviceInfo> cameraList;
|
||||||
std::vector<DeviceInfo> deviceList;
|
std::vector<DeviceInfo> deviceList;
|
||||||
VrAlgorithmParams algorithmParams; // 算法参数
|
VrAlgorithmParams algorithmParams;
|
||||||
std::vector<VrHandEyeCalibMatrix> handEyeCalibMatrixList; // 多相机手眼标定矩阵列表
|
std::vector<VrHandEyeCalibMatrix> handEyeCalibMatrixList;
|
||||||
VrDebugParam debugParam; // 调试参数
|
VrDebugParam debugParam;
|
||||||
SerialConfig serialConfig; // 串口配置
|
SerialConfig serialConfig;
|
||||||
VrPlcRobotServerConfig plcRobotServerConfig; // PLC 和机械臂服务端配置
|
VrPlcRobotServerConfig plcRobotServerConfig;
|
||||||
|
|
||||||
ConfigResult& operator=(const ConfigResult& other) {
|
ConfigResult& operator=(const ConfigResult& other) {
|
||||||
if (this != &other) {
|
if (this != &other) {
|
||||||
@ -207,21 +171,15 @@ struct ConfigResult
|
|||||||
ConfigResult() = default;
|
ConfigResult() = default;
|
||||||
};
|
};
|
||||||
|
|
||||||
/**
|
|
||||||
* @brief 配置加载错误代码
|
|
||||||
*/
|
|
||||||
enum LoadConfigErrorCode
|
enum LoadConfigErrorCode
|
||||||
{
|
{
|
||||||
LOAD_CONFIG_SUCCESS = 0, // 加载成功
|
LOAD_CONFIG_SUCCESS = 0,
|
||||||
LOAD_CONFIG_FILE_NOT_FOUND = -1, // 配置文件不存在
|
LOAD_CONFIG_FILE_NOT_FOUND = -1,
|
||||||
LOAD_CONFIG_PARSE_ERROR = -2, // 配置文件解析错误
|
LOAD_CONFIG_PARSE_ERROR = -2,
|
||||||
LOAD_CONFIG_INVALID_FORMAT = -3, // 配置文件格式无效
|
LOAD_CONFIG_INVALID_FORMAT = -3,
|
||||||
LOAD_CONFIG_UNKNOWN_ERROR = -99 // 未知错误
|
LOAD_CONFIG_UNKNOWN_ERROR = -99
|
||||||
};
|
};
|
||||||
|
|
||||||
/**
|
|
||||||
* @brief VrConfig 接口类
|
|
||||||
*/
|
|
||||||
class IVrConfig
|
class IVrConfig
|
||||||
{
|
{
|
||||||
public:
|
public:
|
||||||
|
|||||||
@ -14,6 +14,7 @@ RansacPlaneSegmentationParams ToAlgoParam(const VrRansacPlaneSegmentationParam&
|
|||||||
algo.growthZThreshold = static_cast<float>(param.growthZThreshold);
|
algo.growthZThreshold = static_cast<float>(param.growthZThreshold);
|
||||||
algo.minPlaneRatio = static_cast<float>(param.minPlaneRatio);
|
algo.minPlaneRatio = static_cast<float>(param.minPlaneRatio);
|
||||||
algo.maxNormalAngleDeg = static_cast<float>(param.maxNormalAngleDeg);
|
algo.maxNormalAngleDeg = static_cast<float>(param.maxNormalAngleDeg);
|
||||||
|
algo.maxDistFromPlane = static_cast<float>(param.maxDistFromPlane);
|
||||||
return algo;
|
return algo;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -66,7 +67,7 @@ void LogAlgoParams(const std::string& logTag,
|
|||||||
clibMatrix[8], clibMatrix[9], clibMatrix[10], clibMatrix[11],
|
clibMatrix[8], clibMatrix[9], clibMatrix[10], clibMatrix[11],
|
||||||
clibMatrix[12], clibMatrix[13], clibMatrix[14], clibMatrix[15]);
|
clibMatrix[12], clibMatrix[13], clibMatrix[14], clibMatrix[15]);
|
||||||
|
|
||||||
LOG_INFO("%s RansacParams: distanceThreshold=%.2f, maxIterations=%d, minPlanePoints=%d, maxPlanes=%d, growthZThreshold=%.2f, minPlaneRatio=%.2f, maxNormalAngleDeg=%.1f\n",
|
LOG_INFO("%s RansacParams: distanceThreshold=%.2f, maxIterations=%d, minPlanePoints=%d, maxPlanes=%d, growthZThreshold=%.2f, minPlaneRatio=%.2f, maxNormalAngleDeg=%.1f, maxDistFromPlane=%.2f\n",
|
||||||
logTag.c_str(),
|
logTag.c_str(),
|
||||||
ransacParams.distanceThreshold,
|
ransacParams.distanceThreshold,
|
||||||
ransacParams.maxIterations,
|
ransacParams.maxIterations,
|
||||||
@ -74,7 +75,8 @@ void LogAlgoParams(const std::string& logTag,
|
|||||||
ransacParams.maxPlanes,
|
ransacParams.maxPlanes,
|
||||||
ransacParams.growthZThreshold,
|
ransacParams.growthZThreshold,
|
||||||
ransacParams.minPlaneRatio,
|
ransacParams.minPlaneRatio,
|
||||||
ransacParams.maxNormalAngleDeg);
|
ransacParams.maxNormalAngleDeg,
|
||||||
|
ransacParams.maxDistFromPlane);
|
||||||
|
|
||||||
LOG_INFO("%s DetectionParams: angleThresholdPos=%.1f, angleThresholdNeg=%.1f, angleSearchDistance=%.2f, minPitDepth=%.2f\n",
|
LOG_INFO("%s DetectionParams: angleThresholdPos=%.1f, angleThresholdNeg=%.1f, angleSearchDistance=%.2f, minPitDepth=%.2f\n",
|
||||||
logTag.c_str(),
|
logTag.c_str(),
|
||||||
|
|||||||
@ -78,6 +78,8 @@ int CVrConfig::LoadConfig(const std::string& filePath, ConfigResult& configResul
|
|||||||
configResult.algorithmParams.ransacParam.minPlaneRatio = ransacParamElement->DoubleAttribute("minPlaneRatio");
|
configResult.algorithmParams.ransacParam.minPlaneRatio = ransacParamElement->DoubleAttribute("minPlaneRatio");
|
||||||
if (ransacParamElement->Attribute("maxNormalAngleDeg"))
|
if (ransacParamElement->Attribute("maxNormalAngleDeg"))
|
||||||
configResult.algorithmParams.ransacParam.maxNormalAngleDeg = ransacParamElement->DoubleAttribute("maxNormalAngleDeg");
|
configResult.algorithmParams.ransacParam.maxNormalAngleDeg = ransacParamElement->DoubleAttribute("maxNormalAngleDeg");
|
||||||
|
if (ransacParamElement->Attribute("maxDistFromPlane"))
|
||||||
|
configResult.algorithmParams.ransacParam.maxDistFromPlane = ransacParamElement->DoubleAttribute("maxDistFromPlane");
|
||||||
}
|
}
|
||||||
|
|
||||||
XMLElement* detectionParamElement = algoParamsElement->FirstChildElement("DetectionParam");
|
XMLElement* detectionParamElement = algoParamsElement->FirstChildElement("DetectionParam");
|
||||||
@ -212,6 +214,7 @@ bool CVrConfig::SaveConfig(const std::string& filePath, ConfigResult& configResu
|
|||||||
ransacParamElement->SetAttribute("growthZThreshold", configResult.algorithmParams.ransacParam.growthZThreshold);
|
ransacParamElement->SetAttribute("growthZThreshold", configResult.algorithmParams.ransacParam.growthZThreshold);
|
||||||
ransacParamElement->SetAttribute("minPlaneRatio", configResult.algorithmParams.ransacParam.minPlaneRatio);
|
ransacParamElement->SetAttribute("minPlaneRatio", configResult.algorithmParams.ransacParam.minPlaneRatio);
|
||||||
ransacParamElement->SetAttribute("maxNormalAngleDeg", configResult.algorithmParams.ransacParam.maxNormalAngleDeg);
|
ransacParamElement->SetAttribute("maxNormalAngleDeg", configResult.algorithmParams.ransacParam.maxNormalAngleDeg);
|
||||||
|
ransacParamElement->SetAttribute("maxDistFromPlane", configResult.algorithmParams.ransacParam.maxDistFromPlane);
|
||||||
algoParamsElement->InsertEndChild(ransacParamElement);
|
algoParamsElement->InsertEndChild(ransacParamElement);
|
||||||
|
|
||||||
// 检测参数 DetectionParam 需要覆盖算法库当前全部检测字段。
|
// 检测参数 DetectionParam 需要覆盖算法库当前全部检测字段。
|
||||||
|
|||||||
@ -14,7 +14,9 @@
|
|||||||
minPlanePoints="100"
|
minPlanePoints="100"
|
||||||
maxPlanes="5"
|
maxPlanes="5"
|
||||||
growthZThreshold="1.0"
|
growthZThreshold="1.0"
|
||||||
minPlaneRatio="0.1"/>
|
minPlaneRatio="0.1"
|
||||||
|
maxNormalAngleDeg="30.0"
|
||||||
|
maxDistFromPlane="1.0"/>
|
||||||
<DetectionParam
|
<DetectionParam
|
||||||
angleThresholdPos="50.0"
|
angleThresholdPos="50.0"
|
||||||
angleThresholdNeg="-50.0"
|
angleThresholdNeg="-50.0"
|
||||||
|
|||||||
@ -187,15 +187,20 @@ int DetectPresenter::DetectScrew(
|
|||||||
double y_scale = (yMax - yMin) / y_rows;
|
double y_scale = (yMax - yMin) / y_rows;
|
||||||
|
|
||||||
// 使用统一的比例尺
|
// 使用统一的比例尺
|
||||||
if (x_scale < y_scale)
|
double scale = std::max(x_scale, y_scale);
|
||||||
x_scale = y_scale;
|
x_scale = scale;
|
||||||
else
|
y_scale = scale;
|
||||||
y_scale = x_scale;
|
|
||||||
|
// 计算居中偏移(与GeneratePointCloudRetPointImage保持一致)
|
||||||
|
double cloudWidth = (xMax - xMin) / scale;
|
||||||
|
double cloudHeight = (yMax - yMin) / scale;
|
||||||
|
int x_offset = x_skip + (int)((x_cols - cloudWidth) / 2);
|
||||||
|
int y_offset = y_skip + (int)((y_rows - cloudHeight) / 2);
|
||||||
|
|
||||||
// 转换3D坐标到图像坐标的lambda函数
|
// 转换3D坐标到图像坐标的lambda函数
|
||||||
auto toImageCoord = [&](const SVzNL3DPoint& pt) -> QPointF {
|
auto toImageCoord = [&](const SVzNL3DPoint& pt) -> QPointF {
|
||||||
int px = (int)((pt.x - xMin) / x_scale + x_skip);
|
int px = (int)((pt.x - xMin) / x_scale + x_offset);
|
||||||
int py = (int)((pt.y - yMin) / y_scale + y_skip);
|
int py = (int)((pt.y - yMin) / y_scale + y_offset);
|
||||||
return QPointF(px, py);
|
return QPointF(px, py);
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|||||||
@ -2,7 +2,7 @@
|
|||||||
#define VERSION_H
|
#define VERSION_H
|
||||||
|
|
||||||
|
|
||||||
#define SCREWPOSITION_VERSION_STRING "1.0.0"
|
#define SCREWPOSITION_VERSION_STRING "1.1.0"
|
||||||
#define SCREWPOSITION_BUILD_STRING "1"
|
#define SCREWPOSITION_BUILD_STRING "1"
|
||||||
#define SCREWPOSITION_FULL_VERSION_STRING "V" SCREWPOSITION_VERSION_STRING "_" SCREWPOSITION_BUILD_STRING
|
#define SCREWPOSITION_FULL_VERSION_STRING "V" SCREWPOSITION_VERSION_STRING "_" SCREWPOSITION_BUILD_STRING
|
||||||
|
|
||||||
|
|||||||
Binary file not shown.
Binary file not shown.
@ -16,6 +16,8 @@ struct RansacPlaneSegmentationParams {
|
|||||||
float minPlaneRatio; // 平面最小点数占比 (相对最大平面), 建议 0.05-0.2
|
float minPlaneRatio; // 平面最小点数占比 (相对最大平面), 建议 0.05-0.2
|
||||||
float maxNormalAngleDeg; // 平面法向量与Z轴最大夹角 (度), 超过则直接丢弃; <=0 表示不过滤
|
float maxNormalAngleDeg; // 平面法向量与Z轴最大夹角 (度), 超过则直接丢弃; <=0 表示不过滤
|
||||||
|
|
||||||
|
float maxDistFromPlane; // 点到平面的最大允许距离;超出则从 pointIndices 中移除;<=0 表示不过滤
|
||||||
|
|
||||||
RansacPlaneSegmentationParams()
|
RansacPlaneSegmentationParams()
|
||||||
: distanceThreshold(0.5f)
|
: distanceThreshold(0.5f)
|
||||||
, maxIterations(500)
|
, maxIterations(500)
|
||||||
@ -24,6 +26,7 @@ struct RansacPlaneSegmentationParams {
|
|||||||
, growthZThreshold(1.0f)
|
, growthZThreshold(1.0f)
|
||||||
, minPlaneRatio(0.1f)
|
, minPlaneRatio(0.1f)
|
||||||
, maxNormalAngleDeg(30.0f)
|
, maxNormalAngleDeg(30.0f)
|
||||||
|
, maxDistFromPlane(1.f)
|
||||||
{
|
{
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|||||||
Binary file not shown.
Binary file not shown.
Binary file not shown.
@ -6,7 +6,7 @@
|
|||||||
|:---:|:--------|:---------|:------------|
|
|:---:|:--------|:---------|:------------|
|
||||||
| 1 | 自动拆包 | GrabBag | 1.3.6.2 |
|
| 1 | 自动拆包 | GrabBag | 1.3.6.2 |
|
||||||
| 2 | 皮带撕裂 | BeltTearingServer | 2.0.8.1 |
|
| 2 | 皮带撕裂 | BeltTearingServer | 2.0.8.1 |
|
||||||
| 3 | 孔洞检测 | HoleDetection | 1.1.3.1 |
|
| 3 | 孔洞检测 | HoleDetection | 1.1.6.1 |
|
||||||
| 4 | 棒材定位 | RodAndBarPosition | 1.0.2.1 |
|
| 4 | 棒材定位 | RodAndBarPosition | 1.0.2.1 |
|
||||||
| 5 | 车轮拱高测量 | WheelMeasure | 1.0.2.1 |
|
| 5 | 车轮拱高测量 | WheelMeasure | 1.0.2.1 |
|
||||||
| 6 | 定子定位 | StatorPosition | 1.0.0.1 |
|
| 6 | 定子定位 | StatorPosition | 1.0.0.1 |
|
||||||
@ -15,7 +15,7 @@
|
|||||||
| 9 | 颗粒尺寸检测 | ParticleSize | 1.0.0.0 |
|
| 9 | 颗粒尺寸检测 | ParticleSize | 1.0.0.0 |
|
||||||
| 10 | 双目标记检测 | BinocularMarkServer | 1.0.0.4 |
|
| 10 | 双目标记检测 | BinocularMarkServer | 1.0.0.4 |
|
||||||
| 11 | 铁路隧道槽道测量 | TunnelChannel | 1.0.0.3 |
|
| 11 | 铁路隧道槽道测量 | TunnelChannel | 1.0.0.3 |
|
||||||
| 12 | 螺杆定位 | ScrewPosition | 1.0.0.1 |
|
| 12 | 螺杆定位 | ScrewPosition | 1.1.0.1 |
|
||||||
| 13 | 包裹拆线位置定位 | BagThreadPosition | 1.0.0.4 |
|
| 13 | 包裹拆线位置定位 | BagThreadPosition | 1.0.0.4 |
|
||||||
| 14 | 工件孔定位 | WorkpieceHole | 1.0.3.0 |
|
| 14 | 工件孔定位 | WorkpieceHole | 1.0.3.0 |
|
||||||
| 16 | 坑孔定位 | HolePitPosition | 无 |
|
| 16 | 坑孔定位 | HolePitPosition | 无 |
|
||||||
|
|||||||
@ -65,6 +65,12 @@ echo "复制 Qt 运行时环境..."
|
|||||||
cp -rfd ${QT_PKG_PATH}/ext ${PKG_PATH}/opt/firefly_qt5.15
|
cp -rfd ${QT_PKG_PATH}/ext ${PKG_PATH}/opt/firefly_qt5.15
|
||||||
cp ${QT_PKG_PATH}/target_qtEnv.sh ${PKG_PATH}/etc/profile.d/
|
cp ${QT_PKG_PATH}/target_qtEnv.sh ${PKG_PATH}/etc/profile.d/
|
||||||
|
|
||||||
|
echo "清理不需要的 Qt WebEngine 库文件..."
|
||||||
|
rm -f ${PKG_PATH}/opt/firefly_qt5.15/lib/libQt5WebEngine*
|
||||||
|
rm -rf ${PKG_PATH}/opt/firefly_qt5.15/libexec/QtWebEngineProcess
|
||||||
|
rm -rf ${PKG_PATH}/opt/firefly_qt5.15/resources/qtwebengine*
|
||||||
|
rm -rf ${PKG_PATH}/opt/firefly_qt5.15/translations/qtwebengine*
|
||||||
|
|
||||||
# 复制 Qt 库文件
|
# 复制 Qt 库文件
|
||||||
for libfile in ${QT_LIB_PATH}/*.so*; do
|
for libfile in ${QT_LIB_PATH}/*.so*; do
|
||||||
# 获取文件名用于比较
|
# 获取文件名用于比较
|
||||||
|
|||||||
@ -85,7 +85,7 @@ declare -A PROJECT_CHINESE_NAMES=(
|
|||||||
)
|
)
|
||||||
|
|
||||||
# 应用列表文件路径
|
# 应用列表文件路径
|
||||||
APP_LIST_FILE="应用列表及说明.md"
|
APP_LIST_FILE="AppList.md"
|
||||||
|
|
||||||
# 获取脚本所在目录
|
# 获取脚本所在目录
|
||||||
SCRIPT_DIR="$(cd "$(dirname "${BASH_SOURCE[0]}")" && pwd)"
|
SCRIPT_DIR="$(cd "$(dirname "${BASH_SOURCE[0]}")" && pwd)"
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user