hybridPosePositioning
version 1.4.2 : 转子钢芯, 优化了点云中垂直部分去除的门限
This commit is contained in:
parent
a6f1514273
commit
8962f03d2a
@ -285,7 +285,7 @@ void _removeZeroLines_XYZUV(std::vector<std::vector< SVzNLPositionD>>& scanData)
|
||||
}
|
||||
|
||||
|
||||
void vzReadObj2DROI_1(const char* fileName, std::vector<WD_objArea2D>& objROIs)
|
||||
void vzReadObj2DROI(const char* fileName, std::vector<WD_objArea2D>& objROIs)
|
||||
{
|
||||
std::ifstream inputFile(fileName);
|
||||
std::string linedata;
|
||||
@ -300,9 +300,19 @@ void vzReadObj2DROI_1(const char* fileName, std::vector<WD_objArea2D>& objROIs)
|
||||
int objID;
|
||||
char type;
|
||||
float L, T, W, H, score;
|
||||
sscanf_s(linedata.c_str(), "obj_%d: C=%c, Rect={ %f, %f, %f, %f }, Score=%f",
|
||||
&objID, &type, sizeof(type), &L, &T, &W, &H, &score);
|
||||
|
||||
size_t pos = linedata.find("Rect");
|
||||
if (pos != std::string::npos)
|
||||
sscanf_s(linedata.c_str(), "obj_%d: C=%c, Rect={ %f, %f, %f, %f }, Score=%f", &objID, &type, sizeof(type), &L, &T, &W, &H, &score);
|
||||
else
|
||||
{
|
||||
float Cx, Cy, R;
|
||||
sscanf_s(linedata.c_str(), "obj_%d: C=%c, { %f, %f }, R=%f, Score=%f",
|
||||
&objID, &type, sizeof(type), &Cx, &Cy, &R, &score);
|
||||
L = Cx - R;
|
||||
T = Cy - R;
|
||||
W = R * 2;
|
||||
H = R * 2;
|
||||
}
|
||||
WD_objArea2D a_roi;
|
||||
if ('a' == type)
|
||||
a_roi.workpieceType = 1;
|
||||
@ -322,6 +332,7 @@ void vzReadObj2DROI_1(const char* fileName, std::vector<WD_objArea2D>& objROIs)
|
||||
return;
|
||||
}
|
||||
|
||||
#if 0
|
||||
void vzReadObj2DROI(const char* fileName, std::vector<WD_objArea2D>& objROIs)
|
||||
{
|
||||
std::ifstream inputFile(fileName);
|
||||
@ -358,6 +369,7 @@ void vzReadObj2DROI(const char* fileName, std::vector<WD_objArea2D>& objROIs)
|
||||
inputFile.close();
|
||||
return;
|
||||
}
|
||||
#endif
|
||||
|
||||
void _outputRGBDResult_XYZUV_RGBD(
|
||||
char* fileName,
|
||||
@ -2188,7 +2200,7 @@ void HaiRuiMa_TaperedWorkpiece_test(void)
|
||||
|
||||
sprintf_s(_scan_file, "%s%d_result.txt", dataPath[grp], fidx);
|
||||
std::vector<WD_objArea2D> objROIs;
|
||||
vzReadObj2DROI_1(_scan_file, objROIs);
|
||||
vzReadObj2DROI(_scan_file, objROIs);
|
||||
|
||||
long t1 = (long)GetTickCount64();//统计时间
|
||||
|
||||
@ -2351,13 +2363,13 @@ void HaiRuiMa_rotorCorePositioning_test(void)
|
||||
};
|
||||
|
||||
SVzNLRange fileIdx[HRM_RotorCore_TEST_GROUP] = {
|
||||
{1,10}, {3,70},{2,2}, {1,47}, {1,54}
|
||||
{1,10}, {3,70},{3,7}, {1,47}, {1,54}
|
||||
};
|
||||
|
||||
const char* ver = wd_hybridPositioningVersion();
|
||||
printf("ver:%s\n", ver);
|
||||
|
||||
for (int grp = 3; grp < HRM_RotorCore_TEST_GROUP; grp++)
|
||||
for (int grp = 2; grp <= 2; grp++)
|
||||
{
|
||||
SSG_planeCalibPara groundCalibPara;
|
||||
//初始化成单位阵
|
||||
@ -2427,10 +2439,7 @@ void HaiRuiMa_rotorCorePositioning_test(void)
|
||||
else
|
||||
sprintf_s(_scan_file, "%s%d_result.txt", dataPath[grp], fidx);
|
||||
std::vector<WD_objArea2D> objROIs;
|
||||
if( ((grp == 0) && (fidx <= 9)) || ((grp >=3)&&(grp<=4)))
|
||||
vzReadObj2DROI(_scan_file, objROIs);
|
||||
else
|
||||
vzReadObj2DROI_1(_scan_file, objROIs);
|
||||
|
||||
SWD_Cylinder workpieceParam; //圆柱形工件的标称半径和高度
|
||||
if (grp == 3)
|
||||
@ -2451,7 +2460,7 @@ void HaiRuiMa_rotorCorePositioning_test(void)
|
||||
|
||||
SVzNLSizeD spacerParam; //隔板参数:长和宽
|
||||
spacerParam.dWidth = 720.0;
|
||||
spacerParam.dHeight = 510.0;
|
||||
spacerParam.dHeight = 520.0;
|
||||
|
||||
double layerRatio = 0.5; //分层系数,分层门限=分层系数*工件高度;当两个工件的高度差大于分层门限时,判断为在不同层
|
||||
const double distToSideRatio = 1.1; //边距系数,边距门限=边距系数*工件直径;当工件距边的距离大于边距门限时,判断为边上的工件
|
||||
|
||||
@ -24,7 +24,8 @@
|
||||
//version 1.3.11 : 转子钢芯, 将边距系数由内部参数转为输入参数
|
||||
//version 1.4.0 : 转子钢芯, 添加了隔板的识别和定位。 当定位隔板时,工件类型为9
|
||||
//version 1.4.1 : 转子钢芯, 每个输出结果添加了2D图像坐标
|
||||
std::string m_strVersion = "HybridPositioning 1.4.1";
|
||||
//version 1.4.2 : 转子钢芯, 优化了点云中垂直部分去除的门限
|
||||
std::string m_strVersion = "HybridPositioning 1.4.2";
|
||||
const char* wd_hybridPositioningVersion(void)
|
||||
{
|
||||
return m_strVersion.c_str();
|
||||
@ -400,7 +401,7 @@ WD_workpieceInfo _computeWorkpiecePose(
|
||||
std::vector<std::vector<SWD_indexingSeg>> vScanLineSegs;
|
||||
for (int line = 0; line < lineNum; line++)
|
||||
{
|
||||
if (line == 83)
|
||||
if (line == 62)
|
||||
int kkk = 1;
|
||||
//分段
|
||||
std::vector<SSG_RUN> simpleSegs;
|
||||
@ -1570,7 +1571,7 @@ void wd_HRM_RotorCorePositioning(
|
||||
SSG_cornerParam removeVertialPara;
|
||||
memset(&removeVertialPara, 0, sizeof(SSG_cornerParam));
|
||||
removeVertialPara.scale = 3.0;
|
||||
removeVertialPara.cornerTh = 60;
|
||||
removeVertialPara.cornerTh = 45;
|
||||
|
||||
std::vector<std::vector<int>> flags;
|
||||
flags.resize(lineNum);
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user