更新算法(增加了参数),微调页面和logo

This commit is contained in:
yiyi 2026-04-06 00:07:11 +08:00
parent 48962d7c1e
commit 807df6c110
15 changed files with 51 additions and 25 deletions

View File

@ -205,13 +205,14 @@ 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\n", LOG_INFO("Loaded XML params - Ransac: distanceThreshold=%.2f, maxIterations=%d, minPlanePoints=%d, maxPlanes=%d, growthZThreshold=%.2f, minPlaneRatio=%.2f, maxNormalAngleDeg=%.1f\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);
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,

View File

@ -5,7 +5,7 @@
#define HOLEDETECTION_APP_NAME "孔洞检测" #define HOLEDETECTION_APP_NAME "孔洞检测"
// 版本字符串 // 版本字符串
#define HOLEDETECTION_VERSION_STRING "1.1.4" #define HOLEDETECTION_VERSION_STRING "1.1.5"
#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

View File

@ -1,37 +1,40 @@
# 1.1.4 2026-04-05 ## 1.1.5 2026-04-05
## build_1 * build_1
1. 更新算法 1.0.2
## 1.1.4 2026-04-05
* build_1
1. 修复 释放点云内存的问题 1. 修复 释放点云内存的问题
## 1.1.3 2026-04-05
# 1.1.3 2026-04-05 * build_1
## build_1
1. 更新算法 1.0.1 1. 更新算法 1.0.1
# 1.1.2 2026-04-02 ## 1.1.2 2026-04-02
## build_1 * build_1
1. 更新算法 1. 更新算法
2. 完善算法参数页面参数配置 2. 完善算法参数页面参数配置
# 1.1.1 2026-04-02 ## 1.1.1 2026-04-02
## build_1 * build_1
1. 更新算法 1. 更新算法
# 1.1.0 2026-03-25 ## 1.1.0 2026-03-25
## build_1 * build_1
1. 算法优化 1. 算法优化
2. 配置结构修改 2. 配置结构修改
3. 手眼标定,网络配置公用 3. 手眼标定,网络配置公用
# 1.0.0 2026-03-11 ## 1.0.0 2026-03-11
## build_4 * build_4
1. 修复矩阵配置 1. 修复矩阵配置
## build_3 * build_3
1. 更新算法库 1. 更新算法库
## build_2 * build_2
1. 修复单相机检测结果不全的问题 1. 修复单相机检测结果不全的问题
## build_1 * build_1
1. 初始版本 1. 初始版本

View File

@ -300,6 +300,7 @@ void DialogAlgoarg::LoadRansacParamToUI(const VrRansacPlaneSegmentationParam& pa
ui->lineEdit_maxPlanes->setText(QString::number(param.maxPlanes)); ui->lineEdit_maxPlanes->setText(QString::number(param.maxPlanes));
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));
} }
void DialogAlgoarg::LoadDetectionParamToUI(const VrHoleDetectionParam& param) void DialogAlgoarg::LoadDetectionParamToUI(const VrHoleDetectionParam& param)
@ -377,6 +378,9 @@ bool DialogAlgoarg::SaveRansacParamFromUI(VrRansacPlaneSegmentationParam& param)
param.minPlaneRatio = ui->lineEdit_minPlaneRatio->text().toDouble(&ok); param.minPlaneRatio = ui->lineEdit_minPlaneRatio->text().toDouble(&ok);
if (!ok) return false; if (!ok) return false;
param.maxNormalAngleDeg = ui->lineEdit_maxNormalAngleDeg->text().toDouble(&ok);
if (!ok) return false;
return true; return true;
} }

View File

@ -168,6 +168,16 @@ QScrollArea { border: none; }</string>
<item row="5" column="1"> <item row="5" column="1">
<widget class="QLineEdit" name="lineEdit_minPlaneRatio"/> <widget class="QLineEdit" name="lineEdit_minPlaneRatio"/>
</item> </item>
<item row="6" column="0">
<widget class="QLabel" name="label_maxNormalAngleDeg">
<property name="text">
<string>法向量最大夹角 (度):</string>
</property>
</widget>
</item>
<item row="6" column="1">
<widget class="QLineEdit" name="lineEdit_maxNormalAngleDeg"/>
</item>
</layout> </layout>
</widget> </widget>
</item> </item>

View File

@ -97,7 +97,7 @@ background-color: rgba(255, 255, 255, 0);</string>
<widget class="QPushButton" name="btn_test"> <widget class="QPushButton" name="btn_test">
<property name="geometry"> <property name="geometry">
<rect> <rect>
<x>973</x> <x>1110</x>
<y>21</y> <y>21</y>
<width>220</width> <width>220</width>
<height>80</height> <height>80</height>
@ -120,7 +120,7 @@ border: none;</string>
<widget class="QPushButton" name="btn_algo_config"> <widget class="QPushButton" name="btn_algo_config">
<property name="geometry"> <property name="geometry">
<rect> <rect>
<x>728</x> <x>845</x>
<y>21</y> <y>21</y>
<width>220</width> <width>220</width>
<height>80</height> <height>80</height>
@ -143,7 +143,7 @@ border: none;</string>
<widget class="QPushButton" name="btn_camera"> <widget class="QPushButton" name="btn_camera">
<property name="geometry"> <property name="geometry">
<rect> <rect>
<x>483</x> <x>580</x>
<y>21</y> <y>21</y>
<width>220</width> <width>220</width>
<height>80</height> <height>80</height>
@ -330,7 +330,7 @@ background-color: rgba(255, 255, 255, 0);</string>
<x>0</x> <x>0</x>
<y>0</y> <y>0</y>
<width>1920</width> <width>1920</width>
<height>21</height> <height>20</height>
</rect> </rect>
</property> </property>
<property name="styleSheet"> <property name="styleSheet">

View File

@ -23,6 +23,7 @@ struct VrRansacPlaneSegmentationParam
int maxPlanes = 5; // 最大提取平面数量 int maxPlanes = 5; // 最大提取平面数量
double growthZThreshold = 1.0; // 区域生长时相邻点 Z 差阈值mm double growthZThreshold = 1.0; // 区域生长时相邻点 Z 差阈值mm
double minPlaneRatio = 0.1; // 平面最小点数占比 double minPlaneRatio = 0.1; // 平面最小点数占比
double maxNormalAngleDeg = 30.0; // 平面法向量与Z轴最大夹角<=0 表示不过滤
}; };
/** /**

View File

@ -13,6 +13,7 @@ RansacPlaneSegmentationParams ToAlgoParam(const VrRansacPlaneSegmentationParam&
algo.maxPlanes = param.maxPlanes; algo.maxPlanes = param.maxPlanes;
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);
return algo; return algo;
} }
@ -65,14 +66,15 @@ 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\n", LOG_INFO("%s RansacParams: distanceThreshold=%.2f, maxIterations=%d, minPlanePoints=%d, maxPlanes=%d, growthZThreshold=%.2f, minPlaneRatio=%.2f, maxNormalAngleDeg=%.1f\n",
logTag.c_str(), logTag.c_str(),
ransacParams.distanceThreshold, ransacParams.distanceThreshold,
ransacParams.maxIterations, ransacParams.maxIterations,
ransacParams.minPlanePoints, ransacParams.minPlanePoints,
ransacParams.maxPlanes, ransacParams.maxPlanes,
ransacParams.growthZThreshold, ransacParams.growthZThreshold,
ransacParams.minPlaneRatio); ransacParams.minPlaneRatio,
ransacParams.maxNormalAngleDeg);
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(),

View File

@ -76,6 +76,8 @@ int CVrConfig::LoadConfig(const std::string& filePath, ConfigResult& configResul
configResult.algorithmParams.ransacParam.growthZThreshold = ransacParamElement->DoubleAttribute("growthZThreshold"); configResult.algorithmParams.ransacParam.growthZThreshold = ransacParamElement->DoubleAttribute("growthZThreshold");
if (ransacParamElement->Attribute("minPlaneRatio")) if (ransacParamElement->Attribute("minPlaneRatio"))
configResult.algorithmParams.ransacParam.minPlaneRatio = ransacParamElement->DoubleAttribute("minPlaneRatio"); configResult.algorithmParams.ransacParam.minPlaneRatio = ransacParamElement->DoubleAttribute("minPlaneRatio");
if (ransacParamElement->Attribute("maxNormalAngleDeg"))
configResult.algorithmParams.ransacParam.maxNormalAngleDeg = ransacParamElement->DoubleAttribute("maxNormalAngleDeg");
} }
XMLElement* detectionParamElement = algoParamsElement->FirstChildElement("DetectionParam"); XMLElement* detectionParamElement = algoParamsElement->FirstChildElement("DetectionParam");
@ -209,6 +211,7 @@ bool CVrConfig::SaveConfig(const std::string& filePath, ConfigResult& configResu
ransacParamElement->SetAttribute("maxPlanes", configResult.algorithmParams.ransacParam.maxPlanes); ransacParamElement->SetAttribute("maxPlanes", configResult.algorithmParams.ransacParam.maxPlanes);
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);
algoParamsElement->InsertEndChild(ransacParamElement); algoParamsElement->InsertEndChild(ransacParamElement);
// 检测参数 DetectionParam 需要覆盖算法库当前全部检测字段。 // 检测参数 DetectionParam 需要覆盖算法库当前全部检测字段。

View File

@ -14,6 +14,7 @@ struct RansacPlaneSegmentationParams {
int maxPlanes; // 最大提取平面数量, 建议 3-10 int maxPlanes; // 最大提取平面数量, 建议 3-10
float growthZThreshold; // 区域生长时相邻点Z差阈值 (mm), 建议 0.5-2.0 float growthZThreshold; // 区域生长时相邻点Z差阈值 (mm), 建议 0.5-2.0
float minPlaneRatio; // 平面最小点数占比 (相对最大平面), 建议 0.05-0.2 float minPlaneRatio; // 平面最小点数占比 (相对最大平面), 建议 0.05-0.2
float maxNormalAngleDeg; // 平面法向量与Z轴最大夹角 (度), 超过则直接丢弃; <=0 表示不过滤
RansacPlaneSegmentationParams() RansacPlaneSegmentationParams()
: distanceThreshold(0.5f) : distanceThreshold(0.5f)
@ -22,6 +23,7 @@ struct RansacPlaneSegmentationParams {
, maxPlanes(5) , maxPlanes(5)
, growthZThreshold(1.0f) , growthZThreshold(1.0f)
, minPlaneRatio(0.1f) , minPlaneRatio(0.1f)
, maxNormalAngleDeg(30.0f)
{ {
} }
}; };