拆包算法更新:增加是否旋转参数

This commit is contained in:
yiyi 2025-10-08 23:00:13 +08:00
parent 716fd5089f
commit a355fa904c
17 changed files with 40 additions and 3 deletions

View File

@ -655,6 +655,9 @@ int GrabBagPresenter::InitAlgorithmParams()
m_algoParam.growParam.minLTypeTreeLen = xmlParams.growParam.minLTypeTreeLen; m_algoParam.growParam.minLTypeTreeLen = xmlParams.growParam.minLTypeTreeLen;
m_algoParam.growParam.minVTypeTreeLen = xmlParams.growParam.minVTypeTreeLen; m_algoParam.growParam.minVTypeTreeLen = xmlParams.growParam.minVTypeTreeLen;
// 设置支持旋转参数
m_algoParam.supportRotate = xmlParams.supportRotate;
// 设置颜色参数 // 设置颜色参数
m_hsvCmpParam.hueTh = xmlParams.hsvCmpParam.hueTh ; m_hsvCmpParam.hueTh = xmlParams.hsvCmpParam.hueTh ;
m_hsvCmpParam.saturateTh = xmlParams.hsvCmpParam.saturateTh; m_hsvCmpParam.saturateTh = xmlParams.hsvCmpParam.saturateTh;
@ -686,6 +689,8 @@ int GrabBagPresenter::InitAlgorithmParams()
m_algoParam.growParam.yDeviation_max, m_algoParam.growParam.zDeviation_max, m_algoParam.growParam.yDeviation_max, m_algoParam.growParam.zDeviation_max,
m_algoParam.growParam.maxLineSkipNum, m_algoParam.growParam.maxSkipDistance); m_algoParam.growParam.maxLineSkipNum, m_algoParam.growParam.maxSkipDistance);
LOG_INFO(" SupportRotate: %d\n", m_algoParam.supportRotate);
// 循环打印所有相机的调平参数 // 循环打印所有相机的调平参数
LOG_INFO("Loading plane calibration parameters for all cameras:\n"); LOG_INFO("Loading plane calibration parameters for all cameras:\n");
for (const auto& cameraParam : m_cameraCalibParams) { for (const auto& cameraParam : m_cameraCalibParams) {

View File

@ -2,9 +2,9 @@
#define VERSION_H #define VERSION_H
#define GRABBAG_VERSION_STRING "1.2.0" #define GRABBAG_VERSION_STRING "1.2.1"
#define GRABBAG_BUILD_STRING "1" #define GRABBAG_BUILD_STRING "0"
#define GRABBAG_FULL_VERSION_STRING "V1.2.0_1" #define GRABBAG_FULL_VERSION_STRING "V1.2.1_0"
// 获取版本信息的便捷函数 // 获取版本信息的便捷函数
inline const char* GetGrabBagVersion() { inline const char* GetGrabBagVersion() {

View File

@ -1,3 +1,7 @@
# 1.2.1 2025-10-8
## build_0
1. 更新算法。增加支持旋转参数。
# 1.2.0 2025-9-15 # 1.2.0 2025-9-15
## build_1 ## build_1
1. 增加相机持续连接功能 1. 增加相机持续连接功能

View File

@ -276,6 +276,7 @@ struct VrAlgorithmParams
VrHsvCmpParam hsvCmpParam; // HSV颜色比较参数 VrHsvCmpParam hsvCmpParam; // HSV颜色比较参数
VrRgbColorPattern rgbColorPattern; // RGB颜色模式 VrRgbColorPattern rgbColorPattern; // RGB颜色模式
VrColorTemplateParam colorTemplateParam; // 颜色模板参数 VrColorTemplateParam colorTemplateParam; // 颜色模板参数
int supportRotate; // 是否支持旋转功能
}; };
/** /**

View File

@ -172,6 +172,19 @@ ConfigResult CVrConfig::LoadConfig(const std::string& filePath)
result.algorithmParams.growParam.minVTypeTreeLen = growParamElement->DoubleAttribute("minVTypeTreeLen"); result.algorithmParams.growParam.minVTypeTreeLen = growParamElement->DoubleAttribute("minVTypeTreeLen");
} }
// 解析支持旋转参数
XMLElement* supportRotateElement = algoParamsElement->FirstChildElement("SupportRotate");
if (supportRotateElement)
{
if (supportRotateElement->Attribute("enabled"))
result.algorithmParams.supportRotate = supportRotateElement->IntAttribute("enabled");
}
else
{
// 默认值为0表示不支持旋转
result.algorithmParams.supportRotate = 0;
}
// 解析HSV颜色比较参数 // 解析HSV颜色比较参数
XMLElement* hsvCmpParamElement = algoParamsElement->FirstChildElement("HsvCmpParam"); XMLElement* hsvCmpParamElement = algoParamsElement->FirstChildElement("HsvCmpParam");
if (hsvCmpParamElement) if (hsvCmpParamElement)
@ -506,6 +519,11 @@ bool CVrConfig::SaveConfig(const std::string& filePath, ConfigResult& configResu
growParamElement->SetAttribute("minVTypeTreeLen", configResult.algorithmParams.growParam.minVTypeTreeLen); growParamElement->SetAttribute("minVTypeTreeLen", configResult.algorithmParams.growParam.minVTypeTreeLen);
algoParamsElement->InsertEndChild(growParamElement); algoParamsElement->InsertEndChild(growParamElement);
// 添加支持旋转参数
XMLElement* supportRotateElement = doc.NewElement("SupportRotate");
supportRotateElement->SetAttribute("enabled", configResult.algorithmParams.supportRotate);
algoParamsElement->InsertEndChild(supportRotateElement);
// 添加多相机平面校准参数 // 添加多相机平面校准参数
XMLElement* planeCalibParamsElement = doc.NewElement("PlaneCalibParams"); XMLElement* planeCalibParamsElement = doc.NewElement("PlaneCalibParams");

View File

@ -32,6 +32,9 @@
<GrowParam maxLineSkipNum="5" yDeviation_max="20.0" maxSkipDistance="20.0" <GrowParam maxLineSkipNum="5" yDeviation_max="20.0" maxSkipDistance="20.0"
zDeviation_max="80.0" minLTypeTreeLen="50.0" minVTypeTreeLen="50.0" /> zDeviation_max="80.0" minLTypeTreeLen="50.0" minVTypeTreeLen="50.0" />
<!-- 支持旋转参数 -->
<SupportRotate enabled="0" />
<!-- HSV颜色比较参数 --> <!-- HSV颜色比较参数 -->
<HsvCmpParam hueTh="15.0" saturateTh="120.0" FBVldPtRatioTh="0.075" <HsvCmpParam hueTh="15.0" saturateTh="120.0" FBVldPtRatioTh="0.075"
frontVldPtGreater="true" front_upVldPtGreater="false" back_upVldPtGreater="true" /> frontVldPtGreater="true" front_upVldPtGreater="false" back_upVldPtGreater="true" />

View File

@ -34,6 +34,7 @@ typedef struct
SSG_treeGrowParam growParam; SSG_treeGrowParam growParam;
//SSG_objSortParam sortParam; //SSG_objSortParam sortParam;
//SSG_polarScanParam polarScanParam; //SSG_polarScanParam polarScanParam;
int supportRotate;
}SG_bagPositionParam; }SG_bagPositionParam;
typedef struct typedef struct

View File

@ -219,6 +219,7 @@ typedef struct
double tree_value; double tree_value;
SSG_ROIRectD roi; SSG_ROIRectD roi;
std::vector< SSG_basicFeature1D> treeNodes; std::vector< SSG_basicFeature1D> treeNodes;
int angleChkScalePos; //仅用于加速angleCheck的速度
}SSG_featureTree; }SSG_featureTree;
typedef struct typedef struct

View File

@ -6,3 +6,7 @@
#define SG_ERR_NOT_GRID_FORMAT -1003 #define SG_ERR_NOT_GRID_FORMAT -1003
#define SG_ERR_LABEL_INFO_ERROR -1004 #define SG_ERR_LABEL_INFO_ERROR -1004
#define SG_ERR_INVLD_SORTING_MODE -1005 #define SG_ERR_INVLD_SORTING_MODE -1005
//BQ_workpiece
#define SX_ERR_INVLD_VTREE_NUM -2001
#define SX_ERR_INVLD_HTREE_NUM -2002