workpieceHolePositioning version 1.6.2 : 拓普发算法代码同步。
This commit is contained in:
parent
5c614084d9
commit
67f5f7fee6
@ -1,7 +1,7 @@
|
||||
|
||||
Microsoft Visual Studio Solution File, Format Version 12.00
|
||||
# Visual Studio Version 17
|
||||
VisualStudioVersion = 17.14.37216.2 d17.14
|
||||
VisualStudioVersion = 17.14.37216.2
|
||||
MinimumVisualStudioVersion = 10.0.40219.1
|
||||
Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "fireBrickPositioning", "fireBrickPositioning\fireBrickPositioning.vcxproj", "{BB3FA81E-21D8-40AD-ACE6-49173477F32D}"
|
||||
ProjectSection(ProjectDependencies) = postProject
|
||||
@ -42,8 +42,8 @@ Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "motorStatorPosition", "moto
|
||||
EndProject
|
||||
Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "motorStatorPosition_test", "motorStatorPosition_test\motorStatorPosition_test.vcxproj", "{533E4482-08AE-490F-8757-B4343F2DD6E4}"
|
||||
ProjectSection(ProjectDependencies) = postProject
|
||||
{95DC3F1A-902A-490E-BD3B-B10463CF0EBD} = {95DC3F1A-902A-490E-BD3B-B10463CF0EBD}
|
||||
{427201E1-5922-4F52-A68F-0D82C8F71B01} = {427201E1-5922-4F52-A68F-0D82C8F71B01}
|
||||
{95DC3F1A-902A-490E-BD3B-B10463CF0EBD} = {95DC3F1A-902A-490E-BD3B-B10463CF0EBD}
|
||||
EndProjectSection
|
||||
EndProject
|
||||
Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "beltTearingDetection", "beltTearingDetection\beltTearingDetection.vcxproj", "{564C255D-40C0-4749-AC5C-410DBE0F135F}"
|
||||
@ -103,8 +103,8 @@ Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "lapWeldDetection", "lapWeld
|
||||
EndProject
|
||||
Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "lapWeldDetection_test", "lapWeldDetection_test\lapWeldDetection_test.vcxproj", "{BD65AC40-A2C9-4C8D-ADBA-ABA595C5F32D}"
|
||||
ProjectSection(ProjectDependencies) = postProject
|
||||
{95DC3F1A-902A-490E-BD3B-B10463CF0EBD} = {95DC3F1A-902A-490E-BD3B-B10463CF0EBD}
|
||||
{0C0B9B7A-9BF2-4157-BFFD-D12012E39FA0} = {0C0B9B7A-9BF2-4157-BFFD-D12012E39FA0}
|
||||
{95DC3F1A-902A-490E-BD3B-B10463CF0EBD} = {95DC3F1A-902A-490E-BD3B-B10463CF0EBD}
|
||||
EndProjectSection
|
||||
EndProject
|
||||
Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "BQ_workpieceCornerExtraction", "BQ_workpieceCornerExtraction\BQ_workpieceCornerExtraction.vcxproj", "{AD8415B7-A745-4184-87B8-95619E5066D6}"
|
||||
@ -146,8 +146,8 @@ Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "gasFillingPortPosition", "g
|
||||
EndProject
|
||||
Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "gasFillingPortPosition_test", "gasFillingPortPosition_test\gasFillingPortPosition_test.vcxproj", "{1EF990A1-9CCB-492A-B6CB-5C233300826B}"
|
||||
ProjectSection(ProjectDependencies) = postProject
|
||||
{95DC3F1A-902A-490E-BD3B-B10463CF0EBD} = {95DC3F1A-902A-490E-BD3B-B10463CF0EBD}
|
||||
{5367493C-9799-4684-A809-23B6EF40C70A} = {5367493C-9799-4684-A809-23B6EF40C70A}
|
||||
{95DC3F1A-902A-490E-BD3B-B10463CF0EBD} = {95DC3F1A-902A-490E-BD3B-B10463CF0EBD}
|
||||
EndProjectSection
|
||||
EndProject
|
||||
Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "BQ_assemblyPosition", "BQ_assemblyPosition\BQ_assemblyPosition.vcxproj", "{0E62EEE4-ABB5-4364-A794-CCFFE8815426}"
|
||||
@ -157,8 +157,8 @@ Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "BQ_assemblyPosition", "BQ_a
|
||||
EndProject
|
||||
Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "BQ_assemblyPosition_test", "BQ_assemblyPosition_test\BQ_assemblyPosition_test.vcxproj", "{BC38D1E5-10CB-438B-AC72-6012303CE139}"
|
||||
ProjectSection(ProjectDependencies) = postProject
|
||||
{95DC3F1A-902A-490E-BD3B-B10463CF0EBD} = {95DC3F1A-902A-490E-BD3B-B10463CF0EBD}
|
||||
{0E62EEE4-ABB5-4364-A794-CCFFE8815426} = {0E62EEE4-ABB5-4364-A794-CCFFE8815426}
|
||||
{95DC3F1A-902A-490E-BD3B-B10463CF0EBD} = {95DC3F1A-902A-490E-BD3B-B10463CF0EBD}
|
||||
EndProjectSection
|
||||
EndProject
|
||||
Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "wheelArchHeigthMeasure", "wheelArchHeigthMeaure\wheelArchHeigthMeaure.vcxproj", "{CFE11556-106A-4216-BF62-FDA980528F7A}"
|
||||
@ -179,8 +179,8 @@ Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "HC_channelSpaceMeasure", "H
|
||||
EndProject
|
||||
Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "HC_channelSpaceMeasure_test", "HC_chanelSpaceMeasure_test\HC_chanelSpaceMeasure_test.vcxproj", "{3EC47D19-2562-4303-82B9-6B1C93C5A37A}"
|
||||
ProjectSection(ProjectDependencies) = postProject
|
||||
{95DC3F1A-902A-490E-BD3B-B10463CF0EBD} = {95DC3F1A-902A-490E-BD3B-B10463CF0EBD}
|
||||
{52A65444-8505-4FD5-9501-E2D297E2EB2C} = {52A65444-8505-4FD5-9501-E2D297E2EB2C}
|
||||
{95DC3F1A-902A-490E-BD3B-B10463CF0EBD} = {95DC3F1A-902A-490E-BD3B-B10463CF0EBD}
|
||||
EndProjectSection
|
||||
EndProject
|
||||
Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "rodAndBarDetection_test", "rodAndBarDetection_test\rodAndBarDetection_test.vcxproj", "{59F9508A-4295-4A7D-858C-7B4F0A7F8C82}"
|
||||
@ -234,8 +234,19 @@ Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "steelPipeDetection", "steel
|
||||
EndProject
|
||||
Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "steelPipeDetection_test", "steelPipeDetection_test\steelPipeDetection_test.vcxproj", "{1A2B3C4D-5E6F-4A7B-8C9D-0E1F2A3B4C5D}"
|
||||
ProjectSection(ProjectDependencies) = postProject
|
||||
{95DC3F1A-902A-490E-BD3B-B10463CF0EBD} = {95DC3F1A-902A-490E-BD3B-B10463CF0EBD}
|
||||
{8E5B3C2D-4A1F-4E9B-8D7C-3F2E5A6B7C8D} = {8E5B3C2D-4A1F-4E9B-8D7C-3F2E5A6B7C8D}
|
||||
{95DC3F1A-902A-490E-BD3B-B10463CF0EBD} = {95DC3F1A-902A-490E-BD3B-B10463CF0EBD}
|
||||
EndProjectSection
|
||||
EndProject
|
||||
Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "HC_planeLocalization", "HC_planeLocalization\HC_planeLocalization.vcxproj", "{76989229-C695-43E6-AF6A-CE8DD9980E16}"
|
||||
ProjectSection(ProjectDependencies) = postProject
|
||||
{95DC3F1A-902A-490E-BD3B-B10463CF0EBD} = {95DC3F1A-902A-490E-BD3B-B10463CF0EBD}
|
||||
EndProjectSection
|
||||
EndProject
|
||||
Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "HC_planeLocalization_test", "HC_planeLocalization_test\HC_planeLocalization_test.vcxproj", "{E59226FE-E1FB-4F3B-9A93-A4173BE316B8}"
|
||||
ProjectSection(ProjectDependencies) = postProject
|
||||
{76989229-C695-43E6-AF6A-CE8DD9980E16} = {76989229-C695-43E6-AF6A-CE8DD9980E16}
|
||||
{95DC3F1A-902A-490E-BD3B-B10463CF0EBD} = {95DC3F1A-902A-490E-BD3B-B10463CF0EBD}
|
||||
EndProjectSection
|
||||
EndProject
|
||||
Global
|
||||
@ -606,6 +617,22 @@ Global
|
||||
{1A2B3C4D-5E6F-4A7B-8C9D-0E1F2A3B4C5D}.Release|x64.Build.0 = Release|x64
|
||||
{1A2B3C4D-5E6F-4A7B-8C9D-0E1F2A3B4C5D}.Release|x86.ActiveCfg = Release|Win32
|
||||
{1A2B3C4D-5E6F-4A7B-8C9D-0E1F2A3B4C5D}.Release|x86.Build.0 = Release|Win32
|
||||
{76989229-C695-43E6-AF6A-CE8DD9980E16}.Debug|x64.ActiveCfg = Debug|x64
|
||||
{76989229-C695-43E6-AF6A-CE8DD9980E16}.Debug|x64.Build.0 = Debug|x64
|
||||
{76989229-C695-43E6-AF6A-CE8DD9980E16}.Debug|x86.ActiveCfg = Debug|Win32
|
||||
{76989229-C695-43E6-AF6A-CE8DD9980E16}.Debug|x86.Build.0 = Debug|Win32
|
||||
{76989229-C695-43E6-AF6A-CE8DD9980E16}.Release|x64.ActiveCfg = Release|x64
|
||||
{76989229-C695-43E6-AF6A-CE8DD9980E16}.Release|x64.Build.0 = Release|x64
|
||||
{76989229-C695-43E6-AF6A-CE8DD9980E16}.Release|x86.ActiveCfg = Release|Win32
|
||||
{76989229-C695-43E6-AF6A-CE8DD9980E16}.Release|x86.Build.0 = Release|Win32
|
||||
{E59226FE-E1FB-4F3B-9A93-A4173BE316B8}.Debug|x64.ActiveCfg = Debug|x64
|
||||
{E59226FE-E1FB-4F3B-9A93-A4173BE316B8}.Debug|x64.Build.0 = Debug|x64
|
||||
{E59226FE-E1FB-4F3B-9A93-A4173BE316B8}.Debug|x86.ActiveCfg = Debug|Win32
|
||||
{E59226FE-E1FB-4F3B-9A93-A4173BE316B8}.Debug|x86.Build.0 = Debug|Win32
|
||||
{E59226FE-E1FB-4F3B-9A93-A4173BE316B8}.Release|x64.ActiveCfg = Release|x64
|
||||
{E59226FE-E1FB-4F3B-9A93-A4173BE316B8}.Release|x64.Build.0 = Release|x64
|
||||
{E59226FE-E1FB-4F3B-9A93-A4173BE316B8}.Release|x86.ActiveCfg = Release|Win32
|
||||
{E59226FE-E1FB-4F3B-9A93-A4173BE316B8}.Release|x86.Build.0 = Release|Win32
|
||||
EndGlobalSection
|
||||
GlobalSection(SolutionProperties) = preSolution
|
||||
HideSolutionNode = FALSE
|
||||
|
||||
@ -190,12 +190,21 @@ SG_APISHARED_EXPORT void wd_lineDataSegment_zDist(
|
||||
const SSG_cornerParam cornerPara
|
||||
);
|
||||
|
||||
//计算方向角(不分段)
|
||||
SG_APISHARED_EXPORT void wd_computeDirAngle_wholeLine(
|
||||
std::vector< SVzNL3DPosition>& line_data,
|
||||
const SSG_cornerParam cornerPara,
|
||||
std::vector< SSG_pntDirAngle>& ptDirAngles
|
||||
);
|
||||
|
||||
//计算方向角(不分段):在计算scale的前提下,考虑了两点距离过大时的处理。
|
||||
SG_APISHARED_EXPORT void wd_computeDirAngle_wholeLine2(
|
||||
std::vector< SVzNL3DPosition>& line_data,
|
||||
const double steppingScale,
|
||||
const double invalidScale, //超出此尺度,方向角计算无效
|
||||
std::vector< SSG_pntDirAngle>& ptDirAngles
|
||||
);
|
||||
|
||||
/// 提取激光线上的圆环的上半段弧。宽度由圆环的宽度确定
|
||||
/// seg端点:z距离大于门限
|
||||
/// nPointIdx被重新定义成Feature类型
|
||||
|
||||
@ -776,7 +776,7 @@ void wd_getSegFeatureGrowingTrees_2(
|
||||
{
|
||||
for (int i = 0, i_max = (int)all_lineFeatures.size(); i < i_max; i++)
|
||||
{
|
||||
if (i == 111)
|
||||
if (i == 95)
|
||||
int kkk = 1;
|
||||
std::vector<SWD_segFeature>& a_lineFeatures = all_lineFeatures[i];
|
||||
for (int j = 0, j_max = (int)a_lineFeatures.size(); j < j_max; j++)
|
||||
|
||||
@ -4456,6 +4456,107 @@ void wd_computeDirAngle_wholeLine(
|
||||
}
|
||||
}
|
||||
|
||||
//计算方向角(不分段):在计算scale的前提下,考虑了两点距离过大时的处理。
|
||||
void wd_computeDirAngle_wholeLine2(
|
||||
std::vector< SVzNL3DPosition>& line_data,
|
||||
const double steppingScale,
|
||||
const double invalidScale, //超出此尺度,方向角计算无效
|
||||
std::vector< SSG_pntDirAngle>& ptDirAngles
|
||||
)
|
||||
{
|
||||
ptDirAngles.resize(line_data.size());
|
||||
int dataSize = (int)line_data.size();
|
||||
for (int i = 0; i < dataSize; i++)
|
||||
{
|
||||
if (i == 930)
|
||||
int kkk = 1;
|
||||
|
||||
if (line_data[i].pt3D.z < 1e-4)
|
||||
{
|
||||
ptDirAngles[i].pntIdx = i;
|
||||
ptDirAngles[i].forwardPntIdx = 0;
|
||||
ptDirAngles[i].backwardPntIdx = 0;
|
||||
ptDirAngles[i].type = -1;
|
||||
ptDirAngles[i].forwardAngle = 0;
|
||||
ptDirAngles[i].backwardAngle = 0;
|
||||
ptDirAngles[i].corner = 0;
|
||||
ptDirAngles[i].curr_z = 0;
|
||||
ptDirAngles[i].forwardDiffZ = 0;
|
||||
ptDirAngles[i].backwardDiffZ = 0;
|
||||
continue;
|
||||
|
||||
}
|
||||
//前向寻找
|
||||
int pre_i = -1;
|
||||
double pre_dist = 0;
|
||||
for (int j = i - 1; j >= 0; j--)
|
||||
{
|
||||
if (line_data[j].pt3D.z < 1e-4)
|
||||
continue;
|
||||
|
||||
pre_dist = sqrt(pow(line_data[i].pt3D.y - line_data[j].pt3D.y, 2) +
|
||||
pow(line_data[i].pt3D.z - line_data[j].pt3D.z, 2));
|
||||
if (pre_dist >= steppingScale)
|
||||
{
|
||||
pre_i = j;
|
||||
break;
|
||||
}
|
||||
}
|
||||
if (pre_dist > invalidScale)
|
||||
pre_i = -1;
|
||||
|
||||
//后向寻找
|
||||
int post_i = -1;
|
||||
double post_dist = 0;
|
||||
for (int j = i + 1; j < dataSize; j++)
|
||||
{
|
||||
if (line_data[j].pt3D.z < 1e-4)
|
||||
continue;
|
||||
post_dist = sqrt(pow(line_data[i].pt3D.y - line_data[j].pt3D.y, 2) +
|
||||
pow(line_data[i].pt3D.z - line_data[j].pt3D.z, 2));
|
||||
if (post_dist >= steppingScale)
|
||||
{
|
||||
post_i = j;
|
||||
break;
|
||||
}
|
||||
}
|
||||
if (post_dist > invalidScale)
|
||||
post_i = -1;
|
||||
|
||||
//计算拐角
|
||||
if ((pre_i < 0) || (post_i < 0))
|
||||
{
|
||||
ptDirAngles[i].pntIdx = i;
|
||||
ptDirAngles[i].type = -1;
|
||||
ptDirAngles[i].forwardAngle = 0;
|
||||
ptDirAngles[i].backwardAngle = 0;
|
||||
ptDirAngles[i].forwardPntIdx = 0;
|
||||
ptDirAngles[i].backwardPntIdx = 0;
|
||||
ptDirAngles[i].corner = 0;
|
||||
ptDirAngles[i].curr_z = 0;
|
||||
ptDirAngles[i].forwardDiffZ = 0;
|
||||
ptDirAngles[i].backwardDiffZ = 0;
|
||||
}
|
||||
else
|
||||
{
|
||||
double tanValue_pre = (line_data[i].pt3D.z - line_data[pre_i].pt3D.z) / abs(line_data[i].pt3D.y - line_data[pre_i].pt3D.y);
|
||||
double tanValue_post = (line_data[post_i].pt3D.z - line_data[i].pt3D.z) / abs(line_data[post_i].pt3D.y - line_data[i].pt3D.y);
|
||||
double forwardAngle = atan(tanValue_post) * 180.0 / PI;
|
||||
double backwardAngle = atan(tanValue_pre) * 180.0 / PI;
|
||||
ptDirAngles[i].pntIdx = i;
|
||||
ptDirAngles[i].forwardPntIdx = post_i;
|
||||
ptDirAngles[i].backwardPntIdx = pre_i;
|
||||
ptDirAngles[i].type = 0;
|
||||
ptDirAngles[i].forwardAngle = forwardAngle;
|
||||
ptDirAngles[i].backwardAngle = backwardAngle;
|
||||
ptDirAngles[i].corner = -(forwardAngle - backwardAngle); //图像坐标系与正常坐标系y方向相反,所以有“-”号
|
||||
ptDirAngles[i].forwardDiffZ = line_data[post_i].pt3D.z - line_data[i].pt3D.z;
|
||||
ptDirAngles[i].backwardDiffZ = line_data[i].pt3D.z - line_data[pre_i].pt3D.z;
|
||||
ptDirAngles[i].curr_z = line_data[i].pt3D.z;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// 提取激光线上的圆环的上半段弧。宽度由圆环的宽度确定
|
||||
/// seg端点:z距离大于门限
|
||||
|
||||
@ -107,7 +107,7 @@ void WD_getHoleInfo(
|
||||
//提取线段端点特征
|
||||
for (int line = 0; line < lineNum; line++)
|
||||
{
|
||||
if (line == 137)
|
||||
if (line == 95)
|
||||
int kkk = 1;
|
||||
|
||||
std::vector<SVzNL3DPosition>& lineData = scanLines[line];
|
||||
|
||||
@ -31,7 +31,8 @@
|
||||
//version 1.5.6 : 山东本事机电轮胎定位:优化了轮胎定位算法,使用圆扫描提取轮廓点。
|
||||
//version 1.6.0 : 添加了玖瑞工件(单件)的姿态计算。
|
||||
//version 1.6.1 : 添加了拓普发工件2、工件3、工件4的姿态计算。
|
||||
std::string m_strVersion = "HolePostion 1.6.1";
|
||||
//version 1.6.2 : 拓普发算法代码同步。
|
||||
std::string m_strVersion = "HolePostion 1.6.2";
|
||||
const char* wd_workpieceHolePositioningVersion(void)
|
||||
{
|
||||
return m_strVersion.c_str();
|
||||
@ -1110,6 +1111,64 @@ void _checkWorkpieceCentralHoles(
|
||||
return;
|
||||
}
|
||||
|
||||
//去除扫描线上的凹坑
|
||||
void _rmoveScanlineConcaves(
|
||||
std::vector<SVzNL3DPosition>& lineData,
|
||||
const double steppingScale,
|
||||
const double invalidScale, //超出此尺度,方向角计算无效
|
||||
const double minCornerTh, //凹坑对应的最小拐角
|
||||
const double minConcaveDepth //最小凹坑不深度
|
||||
)
|
||||
{
|
||||
//计算方向角
|
||||
std::vector< SSG_pntDirAngle> ptDirAngles;
|
||||
wd_computeDirAngle_wholeLine2(
|
||||
lineData,
|
||||
steppingScale,
|
||||
invalidScale, //超出此尺度,方向角计算无效
|
||||
ptDirAngles
|
||||
);
|
||||
|
||||
//寻找拐点极大值
|
||||
std::vector< SSG_pntDirAngle> cornerPeakP;
|
||||
std::vector< SSG_pntDirAngle> cornerPeakM;
|
||||
wd_searchCornerPeaks(
|
||||
ptDirAngles,
|
||||
lineData,
|
||||
minCornerTh,
|
||||
steppingScale * 2,
|
||||
cornerPeakP,
|
||||
cornerPeakM
|
||||
);
|
||||
|
||||
//去除
|
||||
const double removeDepthK = 0.75;
|
||||
for (int idx = 0; idx < (int)cornerPeakP.size(); idx++)
|
||||
{
|
||||
SSG_pntDirAngle& a_peak = cornerPeakP[idx];
|
||||
if ((abs(a_peak.forwardDiffZ) > minConcaveDepth) && (abs(a_peak.backwardDiffZ) > minConcaveDepth))
|
||||
{
|
||||
//寻找前后截止点:diffZ的 3/4
|
||||
double zTh = a_peak.curr_z - abs(a_peak.backwardDiffZ) * removeDepthK;
|
||||
for (int i = a_peak.pntIdx; i >= a_peak.backwardPntIdx; i--)
|
||||
{
|
||||
if (lineData[i].pt3D.z > zTh)
|
||||
lineData[i].pt3D.z = 0;
|
||||
else if((lineData[i].pt3D.z > 1e-4) && (lineData[i].pt3D.z < zTh))
|
||||
break;
|
||||
}
|
||||
zTh = a_peak.curr_z - abs(a_peak.forwardDiffZ) * removeDepthK;
|
||||
for (int i = a_peak.pntIdx; i <= a_peak.forwardPntIdx; i++)
|
||||
{
|
||||
if (lineData[i].pt3D.z > zTh)
|
||||
lineData[i].pt3D.z = 0;
|
||||
else if ((lineData[i].pt3D.z > 1e-4) && (lineData[i].pt3D.z < zTh))
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
//工件2: 孔定位-拓普发工件孔定位
|
||||
void wd_workpieceHolePositioning_2(
|
||||
std::vector< std::vector<SVzNL3DPosition>>& scanLinesInput,
|
||||
@ -1148,6 +1207,21 @@ void wd_workpieceHolePositioning_2(
|
||||
{ //行处理
|
||||
//调平,去除地面
|
||||
wd_lineDataR(scanLines[i], groundCalibPara.planeCalib, -1);
|
||||
//wd_lineDataR(scanLinesInput[i], groundCalibPara.planeCalib, -1);
|
||||
}
|
||||
|
||||
//去除凹坑:只有垂直方向上进行。只对小孔有效(小孔在扫描时会形成凹坑
|
||||
double steppingScale = workpiecePara.holeDiameter;
|
||||
double invalidScale = workpiecePara.H; //超出此尺度,方向角计算无效
|
||||
double minCornerTh = 45; //凹坑对应的最小拐角
|
||||
double minConcaveDepth = 4.0;
|
||||
for (int line = 0; line < lineNum; line++)
|
||||
{
|
||||
if (line == 367)
|
||||
int kkk = 1;
|
||||
//remove concave
|
||||
_rmoveScanlineConcaves( scanLines[line], steppingScale, invalidScale, minCornerTh, minConcaveDepth);
|
||||
//_rmoveScanlineConcaves(scanLinesInput[line], steppingScale, invalidScale, minCornerTh, minConcaveDepth);
|
||||
}
|
||||
|
||||
//生成量化数据,以1mm为量化尺度,用于确定工件表面高度
|
||||
@ -1504,6 +1578,7 @@ void wd_workpieceHolePositioning_2(
|
||||
|
||||
//holes[objIdx].radius = -1;
|
||||
SWD_HoleInfo& p0 = holes[objIdx];
|
||||
|
||||
int idx1 = distanceSearchObject(p0.center, holes, workpiecePara.holeDist_W, distDeviation, 0, workpiecePara.H / 2,
|
||||
quantiValue, roi2D, linePointRange);
|
||||
if (idx1 < 0)
|
||||
|
||||
@ -1339,7 +1339,7 @@ void TuoPuFa_holePosition_test(void)
|
||||
long t1 = (long)GetTickCount64();//统计时间
|
||||
|
||||
SSG_lineSegParam lineSegPara;
|
||||
lineSegPara.distScale = 3.0;
|
||||
lineSegPara.distScale = 10.0;
|
||||
lineSegPara.segGapTh_y = 15.0; //
|
||||
lineSegPara.segGapTh_z = 0.0; //z方向间隔大于10mm认为是分段
|
||||
SSG_outlierFilterParam filterParam;
|
||||
@ -1373,15 +1373,15 @@ void TuoPuFa_holePosition_test(void)
|
||||
&errCode);
|
||||
long t2 = (long)GetTickCount64();
|
||||
if(errCode == SX_ERR_UNKNOWN_OBJECT)
|
||||
printf("%s: %d(ms), 有异物残留!\n", _scan_file, (int)(t2 - t1));
|
||||
printf("%s: %d(ms), 有异物残留! ...", _scan_file, (int)(t2 - t1));
|
||||
else if(errCode == SX_ERR_ZERO_OBJECTS)
|
||||
printf("%s: %d(ms), 无产品!\n", _scan_file, (int)(t2 - t1));
|
||||
printf("%s: %d(ms), 无产品! ...", _scan_file, (int)(t2 - t1));
|
||||
else
|
||||
printf("%s: %d(ms), errCode=%d\n", _scan_file, (int)(t2 - t1), errCode);
|
||||
printf("%s: %d(ms), errCode=%d ...", _scan_file, (int)(t2 - t1), errCode);
|
||||
//输出测试结果
|
||||
sprintf_s(_scan_file, "%sresult\\LaserLine%d_result.txt", dataPath[grp], fidx);
|
||||
sprintf_s(_scan_file, "%sresult/LaserLine%d_result.txt", dataPath[grp], fidx);
|
||||
_outputRGBDResult_RGBD(_scan_file, scanLines, workpiecePositioning);
|
||||
sprintf_s(calibFile, "%sresult\\LaserLine%d_corner_info.txt", dataPath[grp], fidx);
|
||||
sprintf_s(calibFile, "%sresult/LaserLine%d_corner_info.txt", dataPath[grp], fidx);
|
||||
_outputWorkpieceInfo(calibFile, workpiecePositioning);
|
||||
|
||||
sprintf_s(calibFile, "%sresult/LaserLine%d_holes_projection.png", dataPath[grp], fidx);
|
||||
@ -1390,6 +1390,7 @@ void TuoPuFa_holePosition_test(void)
|
||||
double displayScale = 0.3;
|
||||
cv::String imgName(calibFile);
|
||||
_genXOYProjectionImage(imgName, scanLines, displayScale, workpiecePositioning, rpy, angleDrawLen);
|
||||
printf("done\n");
|
||||
}
|
||||
}
|
||||
#endif
|
||||
@ -1476,7 +1477,7 @@ void TuoPuFa_holePosition_test2(void)
|
||||
groundCalibPara.invRMatrix[i] = groundCalibPara.planeCalib[i];
|
||||
char calibFile[250];
|
||||
sprintf_s(calibFile, "%sground_calib_para.txt", dataPath[grp]);
|
||||
//groundCalibPara = _readCalibPara(calibFile);
|
||||
groundCalibPara = _readCalibPara(calibFile);
|
||||
|
||||
for (int fidx = fileIdx[grp].nMin; fidx <= fileIdx[grp].nMax; fidx++)
|
||||
{
|
||||
@ -1492,7 +1493,7 @@ void TuoPuFa_holePosition_test2(void)
|
||||
long t1 = (long)GetTickCount64();//统计时间
|
||||
|
||||
SSG_lineSegParam lineSegPara;
|
||||
lineSegPara.distScale = 3.0;
|
||||
lineSegPara.distScale = 10.0;
|
||||
lineSegPara.segGapTh_y = 15.0; //
|
||||
lineSegPara.segGapTh_z = 0.0; //z方向间隔大于10mm认为是分段
|
||||
SSG_outlierFilterParam filterParam;
|
||||
@ -1507,7 +1508,7 @@ void TuoPuFa_holePosition_test2(void)
|
||||
growParam.minVTypeTreeLen = 2.0; //mm
|
||||
WD_workpieceHoleParam workpiecePara;
|
||||
workpiecePara.workpieceType = 0;
|
||||
workpiecePara.holeDiameter = 6.0; //
|
||||
workpiecePara.holeDiameter = 8.0; //
|
||||
workpiecePara.holeDist_W = 32.0;
|
||||
workpiecePara.holeDist_L = 40.0;
|
||||
workpiecePara.xLen = 44;
|
||||
@ -1943,11 +1944,11 @@ void TuoPuFa_holePosition_test5(void)
|
||||
groundCalibPara.invRMatrix[i] = groundCalibPara.planeCalib[i];
|
||||
char calibFile[250];
|
||||
sprintf_s(calibFile, "%sground_calib_para.txt", dataPath[grp]);
|
||||
//groundCalibPara = _readCalibPara(calibFile);
|
||||
groundCalibPara = _readCalibPara(calibFile);
|
||||
|
||||
for (int fidx = fileIdx[grp].nMin; fidx <= fileIdx[grp].nMax; fidx++)
|
||||
{
|
||||
//fidx =2;
|
||||
fidx =2;
|
||||
char _scan_file[256];
|
||||
sprintf_s(_scan_file, "%s%d_LaserData_Jh26B074.txt", dataPath[grp], fidx);
|
||||
std::vector<std::vector< SVzNL3DPosition>> scanLines;
|
||||
@ -1958,8 +1959,17 @@ void TuoPuFa_holePosition_test5(void)
|
||||
|
||||
long t1 = (long)GetTickCount64();//统计时间
|
||||
|
||||
WD_workpieceHoleParam workpiecePara;
|
||||
workpiecePara.workpieceType = 0;
|
||||
workpiecePara.holeDiameter = 10.0; //
|
||||
workpiecePara.holeDist_W = 32.0;
|
||||
workpiecePara.holeDist_L = 40.0;
|
||||
workpiecePara.xLen = 44;
|
||||
workpiecePara.yLen = 70;
|
||||
workpiecePara.H = 28;
|
||||
|
||||
SSG_lineSegParam lineSegPara;
|
||||
lineSegPara.distScale = 3.0;
|
||||
lineSegPara.distScale = workpiecePara.H / 2; //此参数用于确定
|
||||
lineSegPara.segGapTh_y = 15.0; //
|
||||
lineSegPara.segGapTh_z = 0.0; //z方向间隔大于10mm认为是分段
|
||||
SSG_outlierFilterParam filterParam;
|
||||
@ -1972,14 +1982,7 @@ void TuoPuFa_holePosition_test5(void)
|
||||
growParam.zDeviation_max = 10.0;//
|
||||
growParam.minLTypeTreeLen = 2.0; //mm
|
||||
growParam.minVTypeTreeLen = 2.0; //mm
|
||||
WD_workpieceHoleParam workpiecePara;
|
||||
workpiecePara.workpieceType = 0;
|
||||
workpiecePara.holeDiameter = 10.0; //
|
||||
workpiecePara.holeDist_W = 32.0;
|
||||
workpiecePara.holeDist_L = 40.0;
|
||||
workpiecePara.xLen = 44;
|
||||
workpiecePara.yLen = 70;
|
||||
workpiecePara.H = 28;
|
||||
|
||||
int errCode = 0;
|
||||
std::vector< WD_workpieceInfo> workpiecePositioning;
|
||||
wd_workpieceHolePositioning_2(
|
||||
@ -2707,8 +2710,8 @@ int main()
|
||||
//ESG_testMode testMode = keSG_拓普发孔定位_工件1;
|
||||
//ESG_testMode testMode = keSG_拓普发孔定位_工件2;
|
||||
//ESG_testMode testMode = keSG_拓普发孔定位_工件3;
|
||||
//ESG_testMode testMode = keSG_拓普发孔定位_工件4;
|
||||
ESG_testMode testMode = keSG_拓普发孔定位_工件5;
|
||||
ESG_testMode testMode = keSG_拓普发孔定位_工件4;
|
||||
//ESG_testMode testMode = keSG_拓普发孔定位_工件5;
|
||||
//ESG_testMode testMode = keSG_华航孔定位;
|
||||
//ESG_testMode testMode = keSG_微力砂轮盘定位;
|
||||
//ESG_testMode testMode = keSG_微力砂轮架子定位;
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user