hybridPosePositioning

version 1.4.5 : 转子钢芯,隔板检测内部参数修改:2:1抽样,聚类距离门限5mm
This commit is contained in:
jerryzeng 2026-09-30 14:07:11 +08:00
parent 85fb6d1434
commit a0054f7d50
2 changed files with 32 additions and 27 deletions

View File

@ -1924,33 +1924,36 @@ void _genXOYProjectionImage_workpieceInfo(
std::vector<SVzNL3DPoint> binRectVertex;//最小外接矩形顶点 std::vector<SVzNL3DPoint> binRectVertex;//最小外接矩形顶点
if (binInfo) if (binInfo)
{ {
binRectVertex.resize(4); if (binInfo->center.z > 1e-4)
for (int i = 0; i < 4; i++)
{ {
binRectVertex[i] = _ptRotate(binInfo->minRectVertex[i], matrix3d); binRectVertex.resize(4);
if (rx_range.max < rx_range.min) for (int i = 0; i < 4; i++)
{ {
rx_range.min = binRectVertex[i].x; binRectVertex[i] = _ptRotate(binInfo->minRectVertex[i], matrix3d);
rx_range.max = binRectVertex[i].x; if (rx_range.max < rx_range.min)
} {
else
{
if (rx_range.min > binRectVertex[i].x)
rx_range.min = binRectVertex[i].x; rx_range.min = binRectVertex[i].x;
if (rx_range.max < binRectVertex[i].x)
rx_range.max = binRectVertex[i].x; rx_range.max = binRectVertex[i].x;
} }
if (ry_range.max < ry_range.min) else
{ {
ry_range.min = binRectVertex[i].y; if (rx_range.min > binRectVertex[i].x)
ry_range.max = binRectVertex[i].y; rx_range.min = binRectVertex[i].x;
} if (rx_range.max < binRectVertex[i].x)
else rx_range.max = binRectVertex[i].x;
{ }
if (ry_range.min > binRectVertex[i].y) if (ry_range.max < ry_range.min)
{
ry_range.min = binRectVertex[i].y; ry_range.min = binRectVertex[i].y;
if (ry_range.max < binRectVertex[i].y)
ry_range.max = binRectVertex[i].y; ry_range.max = binRectVertex[i].y;
}
else
{
if (ry_range.min > binRectVertex[i].y)
ry_range.min = binRectVertex[i].y;
if (ry_range.max < binRectVertex[i].y)
ry_range.max = binRectVertex[i].y;
}
} }
} }
} }
@ -2364,13 +2367,13 @@ void HaiRuiMa_rotorCorePositioning_test(void)
}; };
SVzNLRange fileIdx[HRM_RotorCore_TEST_GROUP] = { SVzNLRange fileIdx[HRM_RotorCore_TEST_GROUP] = {
{1,10}, {3,70},{9,9}, {5,47}, {1,54}, {1,6} {1,10}, {3,70},{9,9}, {1,49}, {1,54}, {1,6}
}; };
const char* ver = wd_hybridPositioningVersion(); const char* ver = wd_hybridPositioningVersion();
printf("ver:%s\n", ver); printf("ver:%s\n", ver);
for (int grp = 2; grp <= 2; grp++) for (int grp = 3; grp <= 3; grp++)
{ {
SSG_planeCalibPara groundCalibPara; SSG_planeCalibPara groundCalibPara;
//初始化成单位阵 //初始化成单位阵

View File

@ -27,7 +27,8 @@
//version 1.4.2 : 转子钢芯, 优化了点云中垂直部分去除的门限 //version 1.4.2 : 转子钢芯, 优化了点云中垂直部分去除的门限
//version 1.4.3 : 转子钢芯, (1)分层系数和边距系数添加-1.0参数值,表示不进行分层或边距。(2)添加选项选择使用工件的自身法向或统一使用调平地面法向 //version 1.4.3 : 转子钢芯, (1)分层系数和边距系数添加-1.0参数值,表示不进行分层或边距。(2)添加选项选择使用工件的自身法向或统一使用调平地面法向
//version 1.4.4 : 转子钢芯,添加了异常保护 //version 1.4.4 : 转子钢芯,添加了异常保护
std::string m_strVersion = "HybridPositioning 1.4.4"; //version 1.4.5 : 转子钢芯,隔板检测内部参数修改:2:1抽样,聚类距离门限5mm
std::string m_strVersion = "HybridPositioning 1.4.5";
const char* wd_hybridPositioningVersion(void) const char* wd_hybridPositioningVersion(void)
{ {
return m_strVersion.c_str(); return m_strVersion.c_str();
@ -1144,7 +1145,7 @@ void spacerBoardDetection(
for (int line = 0; line < lineNum; line++) for (int line = 0; line < lineNum; line++)
{ {
//scanLines[line].resize(linePtNum); //scanLines[line].resize(linePtNum);
scanLines[line].insert(scanLines[line].end(), scanLinesIn[line * 3].begin(), scanLinesIn[line * 3].end()); scanLines[line].insert(scanLines[line].end(), scanLinesIn[line * xDownSample].begin(), scanLinesIn[line * xDownSample].end());
} }
std::vector<std::vector<SVzNL3DPosition>> localNormals; std::vector<std::vector<SVzNL3DPosition>> localNormals;
localNormals.resize(lineNum); localNormals.resize(lineNum);
@ -1325,7 +1326,7 @@ void spacerBoardDetection(
} }
//聚类 //聚类
int clusterCheckWin = 3; int clusterCheckWin = 3;
double clusterDist = 3.0; double clusterDist = 5.0;
int distType = 1; //0 - 2d distance; 1- 3d distance int distType = 1; //0 - 2d distance; 1- 3d distance
std::vector<std::vector< SVzNL3DPosition>> objClusters; //result std::vector<std::vector< SVzNL3DPosition>> objClusters; //result
wd_pointClustering_speedUp( wd_pointClustering_speedUp(
@ -1500,6 +1501,7 @@ void wd_HRM_RotorCorePositioning(
int* errCode) int* errCode)
{ {
*errCode = 0; *errCode = 0;
memset(&binInfo, 0, sizeof(WD_HRM_BinInfo));
//判断数据格式是否为grid。算法只能处理grid数据格式 //判断数据格式是否为grid。算法只能处理grid数据格式
int lineNum = (int)scanLinesInput.size(); int lineNum = (int)scanLinesInput.size();
@ -1726,7 +1728,7 @@ void wd_HRM_RotorCorePositioning(
SVzNL3DPoint vec_norm = { 0.0, 0.0, -1.0 }; SVzNL3DPoint vec_norm = { 0.0, 0.0, -1.0 };
SVzNL3DPoint calib_board_normal = wd_ptRotate(vec_norm, groundCalibPara.invRMatrix); SVzNL3DPoint calib_board_normal = wd_ptRotate(vec_norm, groundCalibPara.invRMatrix);
double spacerAngleRange = 10.0; double spacerAngleRange = 10.0;
int xDownSample = 3;//扫描方向3:1抽样 int xDownSample = 2;//扫描方向3:1抽样
std::vector<SVzNL3DPosition> spacerPoints; std::vector<SVzNL3DPosition> spacerPoints;
spacerBoardDetection( spacerDetectPoints, spacerParam, xDownSample, chkWin, localR, calib_board_normal, spacerAngleRange, spacerInfo, spacerPoints); spacerBoardDetection( spacerDetectPoints, spacerParam, xDownSample, chkWin, localR, calib_board_normal, spacerAngleRange, spacerInfo, spacerPoints);
if (spacerInfo.center.z > 1e-4) if (spacerInfo.center.z > 1e-4)