wheelArchHeigthMeasure version 1.3.1 :
添加了一个检测轮毂是否存在的函数
This commit is contained in:
parent
098caff171
commit
4acb751647
@ -743,7 +743,7 @@ int main()
|
|||||||
const char* ver = wd_BQWorkpieceCornerVersion();
|
const char* ver = wd_BQWorkpieceCornerVersion();
|
||||||
printf("ver:%s\n", ver);
|
printf("ver:%s\n", ver);
|
||||||
|
|
||||||
for (int grp = 8; grp <= 8; grp++)
|
for (int grp = 7; grp <= 7; grp++)
|
||||||
{
|
{
|
||||||
SSG_planeCalibPara poseCalibPara;
|
SSG_planeCalibPara poseCalibPara;
|
||||||
//初始化成单位阵
|
//初始化成单位阵
|
||||||
@ -765,7 +765,7 @@ int main()
|
|||||||
|
|
||||||
for (int fidx = fileIdx[grp].nMin; fidx <= fileIdx[grp].nMax; fidx++)
|
for (int fidx = fileIdx[grp].nMin; fidx <= fileIdx[grp].nMax; fidx++)
|
||||||
{
|
{
|
||||||
fidx =7;
|
//fidx =2;
|
||||||
char _scan_file[256];
|
char _scan_file[256];
|
||||||
if(0 == grp)
|
if(0 == grp)
|
||||||
sprintf_s(_scan_file, "%sscanData_%d_grid.txt", dataPath[grp], fidx);
|
sprintf_s(_scan_file, "%sscanData_%d_grid.txt", dataPath[grp], fidx);
|
||||||
@ -804,7 +804,7 @@ int main()
|
|||||||
}
|
}
|
||||||
#if 0
|
#if 0
|
||||||
char _out_file[256];
|
char _out_file[256];
|
||||||
sprintf_s(_out_file, "%s_%d_leveling.txt", dataPath[grp], fidx);
|
sprintf_s(_out_file, "%s%d_leveling.txt", dataPath[grp], fidx);
|
||||||
int headNullLines = 0;
|
int headNullLines = 0;
|
||||||
_outputScanDataFile_vector(_out_file, scanLines, false, &headNullLines);
|
_outputScanDataFile_vector(_out_file, scanLines, false, &headNullLines);
|
||||||
#endif
|
#endif
|
||||||
@ -821,9 +821,9 @@ int main()
|
|||||||
filterParam.outlierTh = 5;
|
filterParam.outlierTh = 5;
|
||||||
SSG_treeGrowParam growParam;
|
SSG_treeGrowParam growParam;
|
||||||
growParam.maxLineSkipNum = 10;
|
growParam.maxLineSkipNum = 10;
|
||||||
growParam.yDeviation_max = 10.0;
|
growParam.yDeviation_max = 5.0;
|
||||||
growParam.maxSkipDistance = 10.0;
|
growParam.maxSkipDistance = 5.0;
|
||||||
growParam.zDeviation_max = 10.0;// algoParam.bagParam.bagH / 2; //袋子高度1/2
|
growParam.zDeviation_max = 5.0;//
|
||||||
growParam.minLTypeTreeLen = 100; //mm
|
growParam.minLTypeTreeLen = 100; //mm
|
||||||
growParam.minVTypeTreeLen = 100; //mm
|
growParam.minVTypeTreeLen = 100; //mm
|
||||||
SSX_BQworkpiecePara workpieceParam;
|
SSX_BQworkpiecePara workpieceParam;
|
||||||
@ -831,6 +831,10 @@ int main()
|
|||||||
workpieceParam.lineLen = 120; // 120.0; //直线段长度
|
workpieceParam.lineLen = 120; // 120.0; //直线段长度
|
||||||
else
|
else
|
||||||
workpieceParam.lineLen = 160.0; //直线段长度
|
workpieceParam.lineLen = 160.0; //直线段长度
|
||||||
|
workpieceParam.dirAngleScale = 20.0; //计算方向角的尺度
|
||||||
|
workpieceParam.lineDeviation = 10.0;//直线偏离度。工作直线边缘由于扫描和切割导致波动,此参数用于描述此波动。
|
||||||
|
workpieceParam.minCutAngleTh = 15; //最小截角。由于扫描不全导致的截角,当截角过小时无法区分真下的截角和由于点波动导致的角度波动
|
||||||
|
|
||||||
int errCode = 0;
|
int errCode = 0;
|
||||||
std::vector<SSX_debugInfo> debug_conturs;
|
std::vector<SSX_debugInfo> debug_conturs;
|
||||||
SSX_BQworkpieceResult workpieceCorner = sx_BQ_getWorkpieceCorners(
|
SSX_BQworkpieceResult workpieceCorner = sx_BQ_getWorkpieceCorners(
|
||||||
|
|||||||
@ -48,7 +48,7 @@
|
|||||||
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|x64'" Label="Configuration">
|
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|x64'" Label="Configuration">
|
||||||
<ConfigurationType>Application</ConfigurationType>
|
<ConfigurationType>Application</ConfigurationType>
|
||||||
<UseDebugLibraries>false</UseDebugLibraries>
|
<UseDebugLibraries>false</UseDebugLibraries>
|
||||||
<PlatformToolset>v142</PlatformToolset>
|
<PlatformToolset>v143</PlatformToolset>
|
||||||
<WholeProgramOptimization>true</WholeProgramOptimization>
|
<WholeProgramOptimization>true</WholeProgramOptimization>
|
||||||
<CharacterSet>Unicode</CharacterSet>
|
<CharacterSet>Unicode</CharacterSet>
|
||||||
</PropertyGroup>
|
</PropertyGroup>
|
||||||
|
|||||||
@ -48,7 +48,7 @@
|
|||||||
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|x64'" Label="Configuration">
|
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|x64'" Label="Configuration">
|
||||||
<ConfigurationType>DynamicLibrary</ConfigurationType>
|
<ConfigurationType>DynamicLibrary</ConfigurationType>
|
||||||
<UseDebugLibraries>false</UseDebugLibraries>
|
<UseDebugLibraries>false</UseDebugLibraries>
|
||||||
<PlatformToolset>v142</PlatformToolset>
|
<PlatformToolset>v143</PlatformToolset>
|
||||||
<WholeProgramOptimization>true</WholeProgramOptimization>
|
<WholeProgramOptimization>true</WholeProgramOptimization>
|
||||||
<CharacterSet>Unicode</CharacterSet>
|
<CharacterSet>Unicode</CharacterSet>
|
||||||
</PropertyGroup>
|
</PropertyGroup>
|
||||||
@ -78,12 +78,12 @@
|
|||||||
</PropertyGroup>
|
</PropertyGroup>
|
||||||
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">
|
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">
|
||||||
<LinkIncremental>true</LinkIncremental>
|
<LinkIncremental>true</LinkIncremental>
|
||||||
<IncludePath>..\..\thirdParty\VzNLSDK\Inc;..\..\thirdParty\opencv320\build\include;..\sourceCode;..\sourceCode\inc;F:\ShangGu\ProductDev\AlgoDev\thirdParty\PCL 1.12.0\3rdParty\Eigen\eigen3;$(IncludePath)</IncludePath>
|
<IncludePath>..\..\thirdParty\VzNLSDK\Inc;..\..\thirdParty\opencv320\build\include;..\sourceCode;..\sourceCode\inc;..\..\thirdParty\PCL 1.12.0\3rdParty\Eigen\eigen3;$(IncludePath)</IncludePath>
|
||||||
<OutDir>$(SolutionDir)build\$(Platform)\$(Configuration)\</OutDir>
|
<OutDir>$(SolutionDir)build\$(Platform)\$(Configuration)\</OutDir>
|
||||||
</PropertyGroup>
|
</PropertyGroup>
|
||||||
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|x64'">
|
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|x64'">
|
||||||
<LinkIncremental>false</LinkIncremental>
|
<LinkIncremental>false</LinkIncremental>
|
||||||
<IncludePath>..\..\thirdParty\VzNLSDK\Inc;..\..\thirdParty\opencv320\build\include;..\sourceCode;..\sourceCode\inc;F:\ShangGu\ProductDev\AlgoDev\thirdParty\PCL 1.12.0\3rdParty\Eigen\eigen3;$(IncludePath)</IncludePath>
|
<IncludePath>..\..\thirdParty\VzNLSDK\Inc;..\..\thirdParty\opencv320\build\include;..\sourceCode;..\sourceCode\inc;..\..\thirdParty\PCL 1.12.0\3rdParty\Eigen\eigen3;$(IncludePath)</IncludePath>
|
||||||
<OutDir>$(SolutionDir)build\$(Platform)\$(Configuration)\</OutDir>
|
<OutDir>$(SolutionDir)build\$(Platform)\$(Configuration)\</OutDir>
|
||||||
</PropertyGroup>
|
</PropertyGroup>
|
||||||
<ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">
|
<ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">
|
||||||
|
|||||||
@ -569,6 +569,7 @@ typedef struct
|
|||||||
int pntIdx;
|
int pntIdx;
|
||||||
int forward_pntIdx;
|
int forward_pntIdx;
|
||||||
int backward_pntIdx;
|
int backward_pntIdx;
|
||||||
|
int flag;
|
||||||
SWD_polarPt point;
|
SWD_polarPt point;
|
||||||
}SSG_dirCornerAngle;
|
}SSG_dirCornerAngle;
|
||||||
|
|
||||||
@ -600,6 +601,8 @@ typedef struct
|
|||||||
int L2_ptIndex;
|
int L2_ptIndex;
|
||||||
double cornerAngle;
|
double cornerAngle;
|
||||||
int cornerDir;
|
int cornerDir;
|
||||||
|
int flag;
|
||||||
|
SWD_polarPt point;
|
||||||
}SWD_polarPeakInfo;
|
}SWD_polarPeakInfo;
|
||||||
|
|
||||||
typedef struct
|
typedef struct
|
||||||
|
|||||||
@ -8,8 +8,9 @@
|
|||||||
//version 1.0.0 : base version release to customer
|
//version 1.0.0 : base version release to customer
|
||||||
//version 1.1.0 : 添加了轮眉到地面高度输出
|
//version 1.1.0 : 添加了轮眉到地面高度输出
|
||||||
//version 1.2.0 : 修正了地面调平,防止法向量旋转180度
|
//version 1.2.0 : 修正了地面调平,防止法向量旋转180度
|
||||||
//version 1.3.0 : 修正了寻找上下点使用固定门限的问题
|
//version 1.3.0 : 修正了寻找上下点使用固定门限的问题
|
||||||
std::string m_strVersion = "1.3.0";
|
//version 1.3.1 : 添加了一个检测轮毂是否存在的函数
|
||||||
|
std::string m_strVersion = "1.3.1";
|
||||||
const char* wd_wheelArchHeigthMeasureVersion(void)
|
const char* wd_wheelArchHeigthMeasureVersion(void)
|
||||||
{
|
{
|
||||||
return m_strVersion.c_str();
|
return m_strVersion.c_str();
|
||||||
@ -243,6 +244,35 @@ SVzNL3DPoint _getWheelArcFittingPoint(
|
|||||||
return fitPt;
|
return fitPt;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
bool wd_wheelPresenseDetection(
|
||||||
|
std::vector<std::vector< SVzNL3DPosition>>& scanLines,
|
||||||
|
const SVzNL3DRangeD wheelRoi3d)
|
||||||
|
{
|
||||||
|
int lines = (int)scanLines.size();
|
||||||
|
int validPtNum = 0;
|
||||||
|
for (int line = 0; line < lines; line++)
|
||||||
|
{
|
||||||
|
std::vector< SVzNL3DPosition>& a_line = scanLines[line];
|
||||||
|
int ptNum = (int)a_line.size();
|
||||||
|
for (int i = 0; i < ptNum; i++)
|
||||||
|
{
|
||||||
|
SVzNL3DPoint& a_pt3D = a_line[i].pt3D;
|
||||||
|
if ( (a_pt3D.x > wheelRoi3d.xRange.min) && (a_pt3D.x < wheelRoi3d.xRange.max)&&
|
||||||
|
(a_pt3D.y > wheelRoi3d.yRange.min) && (a_pt3D.y < wheelRoi3d.yRange.max)&&
|
||||||
|
(a_pt3D.z > wheelRoi3d.zRange.min) && (a_pt3D.z < wheelRoi3d.zRange.max) && (a_pt3D.z> 1e-4))
|
||||||
|
{
|
||||||
|
validPtNum++;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
if (validPtNum > 1000)
|
||||||
|
return true;
|
||||||
|
else
|
||||||
|
return false;
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
//轮眉高度测量
|
//轮眉高度测量
|
||||||
WD_wheelArchInfo wd_wheelArchHeigthMeasure(
|
WD_wheelArchInfo wd_wheelArchHeigthMeasure(
|
||||||
std::vector< std::vector<SVzNL3DPosition>>& scanLines,
|
std::vector< std::vector<SVzNL3DPosition>>& scanLines,
|
||||||
|
|||||||
@ -33,6 +33,11 @@ SG_APISHARED_EXPORT void wd_horizonCamera_lineDataR(
|
|||||||
const double* camPoseR,
|
const double* camPoseR,
|
||||||
double groundH);
|
double groundH);
|
||||||
|
|
||||||
|
//相机水平时姿态调平,并去除地面
|
||||||
|
SG_APISHARED_EXPORT bool wd_wheelPresenseDetection(
|
||||||
|
std::vector<std::vector< SVzNL3DPosition>>& scanLine,
|
||||||
|
const SVzNL3DRangeD wheelRoi3d);
|
||||||
|
|
||||||
//提取工件角点及定位长度信息
|
//提取工件角点及定位长度信息
|
||||||
SG_APISHARED_EXPORT WD_wheelArchInfo wd_wheelArchHeigthMeasure(
|
SG_APISHARED_EXPORT WD_wheelArchInfo wd_wheelArchHeigthMeasure(
|
||||||
std::vector< std::vector<SVzNL3DPosition>>& scanLines,
|
std::vector< std::vector<SVzNL3DPosition>>& scanLines,
|
||||||
|
|||||||
@ -2762,19 +2762,8 @@ int main()
|
|||||||
//algoParam.filterParam.outlierTh = 5;
|
//algoParam.filterParam.outlierTh = 5;
|
||||||
|
|
||||||
long t1 = GetTickCount64();
|
long t1 = GetTickCount64();
|
||||||
int lineNum = (int)scanData.size();
|
|
||||||
for (int i = 0; i < lineNum; i++)
|
SVzNL3DRangeD wheelRoi3d = { {-1000, 1000}, {-2000, 2000}, {500, 2500} };
|
||||||
{
|
|
||||||
if (i == 14)
|
|
||||||
int kkk = 1;
|
|
||||||
//行处理
|
|
||||||
//调平,去除地面
|
|
||||||
wd_horizonCamera_lineDataR(scanData[i], poseCalibPara.planeCalib, poseCalibPara.planeHeight-5);
|
|
||||||
}
|
|
||||||
#if 0 //数据转存
|
|
||||||
sprintf_s(_scan_file, "%sLaserLine%d_grid_RTadjust.txt", dataPath[grp], fidx);
|
|
||||||
_outputScanDataFile_self(_scan_file, scanData, 0, 0, 0);
|
|
||||||
#endif
|
|
||||||
SSG_cornerParam cornerParam;
|
SSG_cornerParam cornerParam;
|
||||||
cornerParam.cornerTh = 45; //45度角
|
cornerParam.cornerTh = 45; //45度角
|
||||||
cornerParam.scale = 50; // algoParam.bagParam.bagH / 8; // 15; // algoParam.bagParam.bagH / 8;
|
cornerParam.scale = 50; // algoParam.bagParam.bagH / 8; // 15; // algoParam.bagParam.bagH / 8;
|
||||||
@ -2784,7 +2773,7 @@ int main()
|
|||||||
cornerParam.jumpCornerTh_2 = 60;
|
cornerParam.jumpCornerTh_2 = 60;
|
||||||
|
|
||||||
SSG_lineSegParam lineSegPara;
|
SSG_lineSegParam lineSegPara;
|
||||||
lineSegPara.maxDist = 1.0;
|
lineSegPara.distScale = 1.0;
|
||||||
lineSegPara.segGapTh_y = 5.0; //y方向间隔大于5mm认为是分段
|
lineSegPara.segGapTh_y = 5.0; //y方向间隔大于5mm认为是分段
|
||||||
lineSegPara.segGapTh_z = 10.0; //z方向间隔大于10mm认为是分段
|
lineSegPara.segGapTh_z = 10.0; //z方向间隔大于10mm认为是分段
|
||||||
|
|
||||||
@ -2800,18 +2789,40 @@ int main()
|
|||||||
growParam.minLTypeTreeLen = 100; //mm
|
growParam.minLTypeTreeLen = 100; //mm
|
||||||
growParam.minVTypeTreeLen = 100; //mm
|
growParam.minVTypeTreeLen = 100; //mm
|
||||||
|
|
||||||
int errCode = 0;
|
WD_wheelArchInfo wheelArcHeight;
|
||||||
WD_wheelArchInfo wheelArcHeight = wd_wheelArchHeigthMeasure(
|
memset(&wheelArcHeight, 0, sizeof(WD_wheelArchInfo));
|
||||||
scanData,
|
|
||||||
cornerParam,
|
|
||||||
lineSegPara,
|
|
||||||
filterParam,
|
|
||||||
growParam,
|
|
||||||
poseCalibPara,
|
|
||||||
&errCode);
|
|
||||||
|
|
||||||
|
bool wheePresense = wd_wheelPresenseDetection( scanData, wheelRoi3d);
|
||||||
|
if (true == wheePresense)
|
||||||
|
{
|
||||||
|
int lineNum = (int)scanData.size();
|
||||||
|
for (int i = 0; i < lineNum; i++)
|
||||||
|
{
|
||||||
|
if (i == 14)
|
||||||
|
int kkk = 1;
|
||||||
|
//行处理
|
||||||
|
//调平,去除地面
|
||||||
|
wd_horizonCamera_lineDataR(scanData[i], poseCalibPara.planeCalib, poseCalibPara.planeHeight - 5);
|
||||||
|
}
|
||||||
|
#if 0 //数据转存
|
||||||
|
sprintf_s(_scan_file, "%sLaserLine%d_grid_RTadjust.txt", dataPath[grp], fidx);
|
||||||
|
_outputScanDataFile_self(_scan_file, scanData, 0, 0, 0);
|
||||||
|
#endif
|
||||||
|
|
||||||
|
|
||||||
|
int errCode = 0;
|
||||||
|
WD_wheelArchInfo wheelArcHeight = wd_wheelArchHeigthMeasure(
|
||||||
|
scanData,
|
||||||
|
cornerParam,
|
||||||
|
lineSegPara,
|
||||||
|
filterParam,
|
||||||
|
growParam,
|
||||||
|
poseCalibPara,
|
||||||
|
&errCode);
|
||||||
|
}
|
||||||
long t2 = GetTickCount64();
|
long t2 = GetTickCount64();
|
||||||
|
|
||||||
|
|
||||||
char _dbg_file[256];
|
char _dbg_file[256];
|
||||||
#if 1
|
#if 1
|
||||||
|
|
||||||
|
|||||||
@ -42,13 +42,13 @@
|
|||||||
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|x64'" Label="Configuration">
|
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|x64'" Label="Configuration">
|
||||||
<ConfigurationType>Application</ConfigurationType>
|
<ConfigurationType>Application</ConfigurationType>
|
||||||
<UseDebugLibraries>true</UseDebugLibraries>
|
<UseDebugLibraries>true</UseDebugLibraries>
|
||||||
<PlatformToolset>v142</PlatformToolset>
|
<PlatformToolset>v143</PlatformToolset>
|
||||||
<CharacterSet>Unicode</CharacterSet>
|
<CharacterSet>Unicode</CharacterSet>
|
||||||
</PropertyGroup>
|
</PropertyGroup>
|
||||||
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|x64'" Label="Configuration">
|
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|x64'" Label="Configuration">
|
||||||
<ConfigurationType>Application</ConfigurationType>
|
<ConfigurationType>Application</ConfigurationType>
|
||||||
<UseDebugLibraries>false</UseDebugLibraries>
|
<UseDebugLibraries>false</UseDebugLibraries>
|
||||||
<PlatformToolset>v142</PlatformToolset>
|
<PlatformToolset>v143</PlatformToolset>
|
||||||
<WholeProgramOptimization>true</WholeProgramOptimization>
|
<WholeProgramOptimization>true</WholeProgramOptimization>
|
||||||
<CharacterSet>Unicode</CharacterSet>
|
<CharacterSet>Unicode</CharacterSet>
|
||||||
</PropertyGroup>
|
</PropertyGroup>
|
||||||
|
|||||||
@ -49,13 +49,13 @@
|
|||||||
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|x64'" Label="Configuration">
|
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|x64'" Label="Configuration">
|
||||||
<ConfigurationType>DynamicLibrary</ConfigurationType>
|
<ConfigurationType>DynamicLibrary</ConfigurationType>
|
||||||
<UseDebugLibraries>true</UseDebugLibraries>
|
<UseDebugLibraries>true</UseDebugLibraries>
|
||||||
<PlatformToolset>v142</PlatformToolset>
|
<PlatformToolset>v143</PlatformToolset>
|
||||||
<CharacterSet>Unicode</CharacterSet>
|
<CharacterSet>Unicode</CharacterSet>
|
||||||
</PropertyGroup>
|
</PropertyGroup>
|
||||||
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|x64'" Label="Configuration">
|
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|x64'" Label="Configuration">
|
||||||
<ConfigurationType>DynamicLibrary</ConfigurationType>
|
<ConfigurationType>DynamicLibrary</ConfigurationType>
|
||||||
<UseDebugLibraries>false</UseDebugLibraries>
|
<UseDebugLibraries>false</UseDebugLibraries>
|
||||||
<PlatformToolset>v142</PlatformToolset>
|
<PlatformToolset>v143</PlatformToolset>
|
||||||
<WholeProgramOptimization>true</WholeProgramOptimization>
|
<WholeProgramOptimization>true</WholeProgramOptimization>
|
||||||
<CharacterSet>Unicode</CharacterSet>
|
<CharacterSet>Unicode</CharacterSet>
|
||||||
</PropertyGroup>
|
</PropertyGroup>
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user