解决编译中的warning
This commit is contained in:
parent
cfb412d6cb
commit
1aff330677
@ -38,7 +38,7 @@ void sg_bagPositioning_lineProc(
|
||||
#if BAG_ALGO_USE_CORNER_FEATURE
|
||||
sg_getLineCornerFeature(
|
||||
filterData.data(),
|
||||
filterData.size(),
|
||||
(int)filterData.size(),
|
||||
lineIdx,
|
||||
bagParam.cornerParam,
|
||||
&a_line_features);
|
||||
@ -58,7 +58,7 @@ void sg_bagPositioning_lineProc(
|
||||
//逆时针旋转时 θ > 0 ;顺时针旋转时 θ < 0
|
||||
cv::Point2f _rotate2D(cv::Point2f pt, double sinTheta, double cosTheta)
|
||||
{
|
||||
return (cv::Point2f(pt.x*cosTheta-pt.y*sinTheta, pt.x*sinTheta+pt.y*cosTheta));
|
||||
return (cv::Point2f((float)(pt.x*cosTheta-pt.y*sinTheta), (float)(pt.x*sinTheta+pt.y*cosTheta)));
|
||||
}
|
||||
|
||||
bool compareByHeight(const SSG_2DValueI& a, const SSG_2DValueI& b) {
|
||||
@ -185,7 +185,7 @@ int _computeMaxEmptyLen(std::vector<int>& mask)
|
||||
int maxLen = 0;
|
||||
int emptyLen = 0;
|
||||
int preMaskValue = 0;
|
||||
for (int i = 0, i_max = mask.size(); i < i_max; i++)
|
||||
for (int i = 0, i_max = (int)mask.size(); i < i_max; i++)
|
||||
{
|
||||
if (0 == mask[i])
|
||||
{
|
||||
@ -249,7 +249,7 @@ bool _validateObj_treeROI(
|
||||
std::vector<SVzNLRangeD> rightTreeRanges;
|
||||
std::vector<SSG_ROIRectD> innerTreeROI_v;
|
||||
std::vector<SSG_ROIRectD> innerTreeROI_h;
|
||||
for (int i = 0, i_max = allTreesInfo.size(); i < i_max; i++)
|
||||
for (int i = 0, i_max = (int)allTreesInfo.size(); i < i_max; i++)
|
||||
{
|
||||
SSG_treeInfo* a_treeInfo = &allTreesInfo[i];
|
||||
if (a_treeInfo->treeType == 0)
|
||||
@ -330,7 +330,7 @@ bool _validateObj_treeROI(
|
||||
}
|
||||
//将内部Tree合并
|
||||
std::vector<SVzNLRangeD> innerTreeRange_v;
|
||||
int treeROI_size = innerTreeROI_v.size();
|
||||
int treeROI_size = (int)innerTreeROI_v.size();
|
||||
for (int i = 0; i < treeROI_size; i++)
|
||||
{
|
||||
SSG_ROIRectD* a_roi = &innerTreeROI_v[i];
|
||||
@ -353,7 +353,7 @@ bool _validateObj_treeROI(
|
||||
innerTreeRange_v.push_back(a_range);
|
||||
}
|
||||
std::vector<SVzNLRangeD> innerTreeRange_h;
|
||||
treeROI_size = innerTreeROI_h.size();
|
||||
treeROI_size = (int)innerTreeROI_h.size();
|
||||
for (int i = 0; i < treeROI_size; i++)
|
||||
{
|
||||
SSG_ROIRectD* a_roi = &innerTreeROI_h[i];
|
||||
@ -568,8 +568,8 @@ SSG_peakRgnInfo _getRgnObjInfo(
|
||||
}
|
||||
|
||||
int line = rgnContour[m].x;
|
||||
float x = laser3DPoints[line].p3DPosition[rgnContour[m].y].pt3D.x;
|
||||
float y = laser3DPoints[line].p3DPosition[rgnContour[m].y].pt3D.y;
|
||||
float x = (float)laser3DPoints[line].p3DPosition[rgnContour[m].y].pt3D.x;
|
||||
float y = (float)laser3DPoints[line].p3DPosition[rgnContour[m].y].pt3D.y;
|
||||
points.push_back(cv::Point2f(x, y));
|
||||
}
|
||||
if (points.size() == 0)
|
||||
@ -708,7 +708,7 @@ if ((m == 226) && (n == 742))
|
||||
best_pt = a_pt;
|
||||
}
|
||||
}
|
||||
cv::Point2f r_pt = _rotate2D(cv::Point2f(a_pt->pt3D.x - vertices[0].x, a_pt->pt3D.y - vertices[0].y), sinTheta, cosTheta);
|
||||
cv::Point2f r_pt = _rotate2D(cv::Point2f((float)(a_pt->pt3D.x - vertices[0].x), (float)(a_pt->pt3D.y - vertices[0].y)), sinTheta, cosTheta);
|
||||
if ((r_pt.x >= 0) && (r_pt.x <= rect.size.width) && (r_pt.y <= 0) && (r_pt.y >= -rect.size.height))
|
||||
{
|
||||
int existId = (a_pt->nPointIdx >> 8) & 0xff;
|
||||
@ -1183,8 +1183,8 @@ void _getMatchTable(
|
||||
matchTable.resize(matchSize);
|
||||
for (int m = 0; m < matchSize; m++)
|
||||
matchTable[m].roi.right = -1; //初始化ROI
|
||||
int size_1 = contours_1.size();
|
||||
int size_2 = contours_2.size();
|
||||
int size_1 = (int)contours_1.size();
|
||||
int size_2 = (int)contours_2.size();
|
||||
int m = 0;
|
||||
int n = 0;
|
||||
int matchNum = 0;
|
||||
@ -1363,7 +1363,11 @@ SSG_peakRgnInfo _getPeakRgn(
|
||||
false,
|
||||
&lowLevelFlag_L,
|
||||
&lowLevelFlag_R);
|
||||
int lowLevelFlag = lowLevelFlag_T + lowLevelFlag_B << 1 + lowLevelFlag_L << 2 + lowLevelFlag_R << 3;
|
||||
|
||||
lowLevelFlag_B <<= 1;
|
||||
lowLevelFlag_L <<= 2;
|
||||
lowLevelFlag_R <<= 3;
|
||||
int lowLevelFlag = lowLevelFlag_T + lowLevelFlag_B + lowLevelFlag_L + lowLevelFlag_R;
|
||||
if (lowLevelFlag > 0)
|
||||
*lowLevelChkFlag = lowLevelFlag;
|
||||
|
||||
@ -1399,7 +1403,7 @@ void _refineContourPairs(SSG_matchPair* valid_match, std::vector<SSG_conotourPai
|
||||
double dist_th_H = valid_match->matchValue + sigma_th;
|
||||
valid_match->roi.right = -1;
|
||||
valid_match->roi.left = 0;
|
||||
for (int i = 0, i_max = all_contourPairs.size(); i < i_max; i++)
|
||||
for (int i = 0, i_max = (int)all_contourPairs.size(); i < i_max; i++)
|
||||
{
|
||||
if ((all_contourPairs[i].edgeId_0 == valid_match->id1) && (all_contourPairs[i].edgeId_1 == valid_match->id2))
|
||||
{
|
||||
@ -1493,13 +1497,13 @@ void _refineContourPairs(SSG_matchPair* valid_match, std::vector<SSG_conotourPai
|
||||
a_pair->matchValue = -1.0;
|
||||
}
|
||||
///去除无效匹配
|
||||
int TB_size = TB_pairs.size();
|
||||
int TB_size = (int)TB_pairs.size();
|
||||
for (int i = TB_size - 1; i >= 0; i--)
|
||||
{
|
||||
if ( (TB_pairs[i].matchValue < 0) || (TB_pairs[i].id1 == TB_pairs[i].id2))
|
||||
TB_pairs.erase(TB_pairs.begin() + i);
|
||||
}
|
||||
TB_size = TB_pairs.size();
|
||||
TB_size = (int)TB_pairs.size();
|
||||
//计算每个匹配的平均距离:LR
|
||||
for (int i = 0; i < LR_pairs.size(); i++)
|
||||
{
|
||||
@ -1525,13 +1529,13 @@ void _refineContourPairs(SSG_matchPair* valid_match, std::vector<SSG_conotourPai
|
||||
a_pair->matchValue = -1.0;
|
||||
}
|
||||
///去除无效匹配
|
||||
int LR_size = LR_pairs.size();
|
||||
int LR_size = (int)LR_pairs.size();
|
||||
for (int i = LR_size - 1; i >= 0; i--)
|
||||
{
|
||||
if (( LR_pairs[i].matchValue < 0) || (LR_pairs[i].id1 == LR_pairs[i].id2))
|
||||
LR_pairs.erase(LR_pairs.begin() + i);
|
||||
}
|
||||
LR_size = LR_pairs.size();
|
||||
LR_size = (int)LR_pairs.size();
|
||||
//四种情况:(1)TB一个, LR一个,(2)TB一个,LR多个,(3)TB多个,LR一个(4)TB多个,LR多个
|
||||
int edgeId_top = -1, edgeId_btm = -1, edgeId_left = -1, edgeId_right = -1;
|
||||
SVzNLRangeD L_th = {-80, algoParam.bagParam.bagL * 0.25};
|
||||
@ -2253,7 +2257,7 @@ void sg_getBagPosition(
|
||||
px,
|
||||
py,
|
||||
interPts);
|
||||
for (int m = 0, m_max = interPts.size(); m < m_max; m++)
|
||||
for (int m = 0, m_max = (int)interPts.size(); m < m_max; m++)
|
||||
bwImg.at<uchar>(interPts[m].y, interPts[m].x) = 1;
|
||||
}
|
||||
}
|
||||
@ -2297,7 +2301,7 @@ void sg_getBagPosition(
|
||||
#endif
|
||||
|
||||
int vldRgnSize = (int)((algoParam.bagParam.bagL * algoParam.bagParam.bagW / 2) / (scale * scale));
|
||||
for (int rgnid = 0, rgn_max = labelRgns.size(); rgnid < rgn_max; rgnid++)
|
||||
for (int rgnid = 0, rgn_max = (int)labelRgns.size(); rgnid < rgn_max; rgnid++)
|
||||
{
|
||||
SSG_Region* a_rgn = &labelRgns[rgnid];
|
||||
if (a_rgn->ptCounter < vldRgnSize)
|
||||
@ -2398,7 +2402,7 @@ if (hLine == 14)
|
||||
#if BAG_ALGO_USE_CORNER_FEATURE
|
||||
sg_getLineCornerFeature(
|
||||
smoothData.data(),
|
||||
smoothData.size(),
|
||||
(int)smoothData.size(),
|
||||
hLine,
|
||||
algoParam.cornerParam,
|
||||
&a_hLine_featrues);
|
||||
@ -2440,13 +2444,13 @@ if (hLine == 14)
|
||||
v_edgePts_0,
|
||||
v_edgePts_1);
|
||||
//对tree的node的连续性进行插值,保证无空缺
|
||||
for (int treeId = 0, tree_max = v_trees.size(); treeId < tree_max; treeId++)
|
||||
for (int treeId = 0, tree_max = (int)v_trees.size(); treeId < tree_max; treeId++)
|
||||
{
|
||||
SSG_featureTree& a_vTree = v_trees[treeId];
|
||||
if (a_vTree.treeNodes.size() > 0)
|
||||
{
|
||||
//从后往前处理,这个插值的点插入后不影响继续处理的下标
|
||||
for (int nid = a_vTree.treeNodes.size() - 2; nid >= 0; nid--)
|
||||
for (int nid = (int)a_vTree.treeNodes.size() - 2; nid >= 0; nid--)
|
||||
{
|
||||
SSG_basicFeature1D curr_node = a_vTree.treeNodes[nid];
|
||||
SSG_basicFeature1D nxt_node = a_vTree.treeNodes[nid+1];
|
||||
@ -2520,13 +2524,13 @@ if (hLine == 14)
|
||||
h_edgePts_0,
|
||||
h_edgePts_1);
|
||||
//对tree的node的连续性进行插值,保证无空缺
|
||||
for (int treeId = 0, tree_max = h_trees.size(); treeId < tree_max; treeId++)
|
||||
for (int treeId = 0, tree_max = (int)h_trees.size(); treeId < tree_max; treeId++)
|
||||
{
|
||||
SSG_featureTree& a_hTree = h_trees[treeId];
|
||||
if (a_hTree.treeNodes.size() > 0)
|
||||
{
|
||||
//从后往前处理,这个插值的点插入后不影响继续处理的下标
|
||||
for (int nid = a_hTree.treeNodes.size() - 2; nid >= 0; nid--)
|
||||
for (int nid = (int)a_hTree.treeNodes.size() - 2; nid >= 0; nid--)
|
||||
{
|
||||
SSG_basicFeature1D curr_node = a_hTree.treeNodes[nid];
|
||||
SSG_basicFeature1D nxt_node = a_hTree.treeNodes[nid + 1];
|
||||
@ -2676,7 +2680,7 @@ if (hLine == 14)
|
||||
px,
|
||||
py,
|
||||
interPts);
|
||||
for (int m = 0, m_max = interPts.size(); m < m_max; m++)
|
||||
for (int m = 0, m_max = (int)interPts.size(); m < m_max; m++)
|
||||
distTranformMask.at<float>(interPts[m].y, interPts[m].x) = 1e+6;
|
||||
}
|
||||
}
|
||||
@ -2744,7 +2748,7 @@ if (hLine == 14)
|
||||
}
|
||||
#else //根据起点的生长树进行标注
|
||||
int treeID = 1;
|
||||
for (int i = 0, i_max = vEdge_0_trees.size(); i < i_max; i++)
|
||||
for (int i = 0, i_max = (int)vEdge_0_trees.size(); i < i_max; i++)
|
||||
{
|
||||
SSG_featureTree* a_vEdgeTree = &vEdge_0_trees[i];
|
||||
|
||||
@ -2758,7 +2762,7 @@ if (hLine == 14)
|
||||
a_treeInfo.roi = a_vEdgeTree->roi;
|
||||
allTreesInfo.push_back(a_treeInfo);
|
||||
//在原始点云上标记,同时有Mask上标记
|
||||
for (int j = 0, j_max = a_vEdgeTree->treeNodes.size(); j < j_max; j++)
|
||||
for (int j = 0, j_max = (int)a_vEdgeTree->treeNodes.size(); j < j_max; j++)
|
||||
{
|
||||
SSG_basicFeature1D* a_feature = &a_vEdgeTree->treeNodes[j];
|
||||
if (laser3DPoints[a_feature->jumpPos2D.x].p3DPosition[a_feature->jumpPos2D.y].pt3D.z > 1e-4)//虚假目标过滤后点会置0
|
||||
@ -2804,7 +2808,7 @@ if (hLine == 14)
|
||||
}
|
||||
}
|
||||
#else //根据起点的生长树进行标注
|
||||
for (int i = 0, i_max = vEdge_1_trees.size(); i < i_max; i++)
|
||||
for (int i = 0, i_max = (int)vEdge_1_trees.size(); i < i_max; i++)
|
||||
{
|
||||
SSG_featureTree* a_vEdgeTree = &vEdge_1_trees[i];
|
||||
|
||||
@ -2818,7 +2822,7 @@ if (hLine == 14)
|
||||
a_treeInfo.roi = a_vEdgeTree->roi;
|
||||
allTreesInfo.push_back(a_treeInfo);
|
||||
//在原始点云上标记,同时有Mask上标记
|
||||
for (int j = 0, j_max = a_vEdgeTree->treeNodes.size(); j < j_max; j++)
|
||||
for (int j = 0, j_max = (int)a_vEdgeTree->treeNodes.size(); j < j_max; j++)
|
||||
{
|
||||
SSG_basicFeature1D* a_feature = &a_vEdgeTree->treeNodes[j];
|
||||
if (laser3DPoints[a_feature->jumpPos2D.x].p3DPosition[a_feature->jumpPos2D.y].pt3D.z > 1e-4)//虚假目标过滤后点会置0
|
||||
@ -2865,7 +2869,7 @@ if (hLine == 14)
|
||||
}
|
||||
}
|
||||
#else //根据起点的生长树进行标注
|
||||
for (int i = 0, i_max = hEdge_0_trees.size(); i < i_max; i++)
|
||||
for (int i = 0, i_max = (int)hEdge_0_trees.size(); i < i_max; i++)
|
||||
{
|
||||
SSG_featureTree* a_hEdgeTree = &hEdge_0_trees[i];
|
||||
//记录Tree的信息
|
||||
@ -2881,7 +2885,7 @@ if (hLine == 14)
|
||||
a_treeInfo.roi.bottom = a_hEdgeTree->roi.right;
|
||||
allTreesInfo.push_back(a_treeInfo);
|
||||
//在原始点云上标记,同时有Mask上标记
|
||||
for (int j = 0, j_max = a_hEdgeTree->treeNodes.size(); j < j_max; j++)
|
||||
for (int j = 0, j_max = (int)a_hEdgeTree->treeNodes.size(); j < j_max; j++)
|
||||
{
|
||||
SSG_basicFeature1D* a_feature = &a_hEdgeTree->treeNodes[j];
|
||||
if (laser3DPoints[a_feature->jumpPos2D.y].p3DPosition[a_feature->jumpPos2D.x].pt3D.z > 1e-4)//虚假目标过滤后点会置0
|
||||
@ -2931,7 +2935,7 @@ if (hLine == 14)
|
||||
}
|
||||
}
|
||||
#else //根据起点的生长树进行标注
|
||||
for (int i = 0, i_max = hEdge_1_trees.size(); i < i_max; i++)
|
||||
for (int i = 0, i_max = (int)hEdge_1_trees.size(); i < i_max; i++)
|
||||
{
|
||||
SSG_featureTree* a_hEdgeTree = &hEdge_1_trees[i];
|
||||
//记录Tree的信息
|
||||
@ -2947,7 +2951,7 @@ if (hLine == 14)
|
||||
a_treeInfo.roi.bottom = a_hEdgeTree->roi.right;
|
||||
allTreesInfo.push_back(a_treeInfo);
|
||||
//在原始点云上标记,同时有Mask上标记
|
||||
for (int j = 0, j_max = a_hEdgeTree->treeNodes.size(); j < j_max; j++)
|
||||
for (int j = 0, j_max = (int)a_hEdgeTree->treeNodes.size(); j < j_max; j++)
|
||||
{
|
||||
SSG_basicFeature1D* a_feature = &a_hEdgeTree->treeNodes[j];
|
||||
if (laser3DPoints[a_feature->jumpPos2D.y].p3DPosition[a_feature->jumpPos2D.x].pt3D.z > 1e-4)//虚假目标过滤后点会置0
|
||||
@ -2975,7 +2979,7 @@ if (hLine == 14)
|
||||
//treeIndex 5-8预留给迭代后目标的边界:5-上边界, 6-下边界,7-左边界,8-右边界
|
||||
int hvTreeIdx = treeID;
|
||||
int vTreeStart = treeID;
|
||||
for (int i = 0, i_max = v_trees.size(); i < i_max; i++)
|
||||
for (int i = 0, i_max = (int)v_trees.size(); i < i_max; i++)
|
||||
{
|
||||
SSG_featureTree* a_vTree = &v_trees[i];
|
||||
|
||||
@ -2989,7 +2993,7 @@ if (hLine == 14)
|
||||
a_treeInfo.roi = a_vTree->roi;
|
||||
allTreesInfo.push_back(a_treeInfo);
|
||||
//在原始点云上标记,同时有Mask上标记
|
||||
for (int j = 0, j_max = a_vTree->treeNodes.size(); j < j_max; j++)
|
||||
for (int j = 0, j_max = (int)a_vTree->treeNodes.size(); j < j_max; j++)
|
||||
{
|
||||
SSG_basicFeature1D* a_feature = &a_vTree->treeNodes[j];
|
||||
if (laser3DPoints[a_feature->jumpPos2D.x].p3DPosition[a_feature->jumpPos2D.y].pt3D.z > 1e-4)//虚假目标过滤后点会置0
|
||||
@ -3014,7 +3018,7 @@ if (hLine == 14)
|
||||
}
|
||||
int hTreeStart = hvTreeIdx;
|
||||
////标注:水平特征
|
||||
for (int i = 0, i_max = h_trees.size(); i < i_max; i++)
|
||||
for (int i = 0, i_max = (int)h_trees.size(); i < i_max; i++)
|
||||
{
|
||||
SSG_featureTree* a_hTree = &h_trees[i];
|
||||
//记录Tree的信息
|
||||
@ -3030,7 +3034,7 @@ if (hLine == 14)
|
||||
a_treeInfo.roi.bottom = a_hTree->roi.right;
|
||||
allTreesInfo.push_back(a_treeInfo);
|
||||
//在原始点云上标记,同时有Mask上标记
|
||||
for (int j = 0, j_max = a_hTree->treeNodes.size(); j < j_max; j++)
|
||||
for (int j = 0, j_max = (int)a_hTree->treeNodes.size(); j < j_max; j++)
|
||||
{
|
||||
SSG_basicFeature1D* a_feature = &a_hTree->treeNodes[j];
|
||||
if (laser3DPoints[a_feature->jumpPos2D.y].p3DPosition[a_feature->jumpPos2D.x].pt3D.z > 1e-4)//虚假目标过滤后点会置0
|
||||
@ -3242,7 +3246,7 @@ if (col == 586)
|
||||
}
|
||||
//按照高度排序
|
||||
std::sort(peaks.begin(), peaks.end(), compareByHeight);
|
||||
for (int i = 0, i_max = peaks.size(); i < i_max; i++)
|
||||
for (int i = 0, i_max = (int)peaks.size(); i < i_max; i++)
|
||||
featureMask.at<cv::Vec4i>(peaks[i].y, peaks[i].x)[3] = 1; //peak flag
|
||||
|
||||
#if 0
|
||||
@ -3257,7 +3261,7 @@ if (col == 586)
|
||||
/// 以区域最高点作为种子进行区域生长
|
||||
std::vector<SSG_peakRgnInfo> peakRgns;
|
||||
int peakRgnId = 1;
|
||||
for (int i = 0, i_max = peaks.size(); i < i_max; i++)
|
||||
for (int i = 0, i_max = (int)peaks.size(); i < i_max; i++)
|
||||
{
|
||||
if (i == 3)
|
||||
int kkk = 1;
|
||||
@ -3393,7 +3397,7 @@ if (i == 3)
|
||||
std::vector<SSG_peakRgnInfo> iter_objs;
|
||||
//将没有处理的Peak点保留
|
||||
std::vector<SSG_2DValueI> residualPeaks;
|
||||
for (int i = 0, i_max = peaks.size(); i < i_max; i++)
|
||||
for (int i = 0, i_max = (int)peaks.size(); i < i_max; i++)
|
||||
{
|
||||
SVzNL3DPosition* pk_pt = &(laser3DPoints[peaks[i].x].p3DPosition[peaks[i].y]);
|
||||
int pkRgnId = (pk_pt->nPointIdx >> 8) & 0xff;
|
||||
@ -3544,7 +3548,7 @@ if (i == 3)
|
||||
std::vector<SSG_2DValueI> smallObjPeaks; //记录0.25L * 0.25W的目标,用于碰撞检查
|
||||
//将最后没有处理的Peak点保留
|
||||
std::vector<SSG_2DValueI> residualPeaks;
|
||||
for (int i = 0, i_max = peaks.size(); i < i_max; i++)
|
||||
for (int i = 0, i_max = (int)peaks.size(); i < i_max; i++)
|
||||
{
|
||||
SVzNL3DPosition* pk_pt = &(laser3DPoints[peaks[i].x].p3DPosition[peaks[i].y]);
|
||||
int pkRgnId = (pk_pt->nPointIdx >> 8) & 0xff;
|
||||
@ -3697,7 +3701,7 @@ if (i == 3)
|
||||
}
|
||||
//取同高度层的目标
|
||||
std::vector<SSG_peakRgnInfo> level0_objs;
|
||||
for (int i = 0, i_max = peakRgns.size(); i < i_max; i++)
|
||||
for (int i = 0, i_max = (int)peakRgns.size(); i < i_max; i++)
|
||||
{
|
||||
double z_diff = peakRgns[i].centerPos.z - maxHeight;
|
||||
if (z_diff < algoParam.bagParam.bagH / 2) //分层
|
||||
@ -3707,7 +3711,7 @@ if (i == 3)
|
||||
}
|
||||
peakRgns.clear();
|
||||
peakRgns.insert(peakRgns.end(), level0_objs.begin(), level0_objs.end());
|
||||
int level0_size = peakRgns.size();
|
||||
int level0_size = (int)peakRgns.size();
|
||||
if (level0_size > 1) //进一步排序,分行
|
||||
{
|
||||
//取Y最小的目标
|
||||
@ -3790,7 +3794,7 @@ if (i == 3)
|
||||
invMatrix[2][0] = poseCalibPara.invRMatrix[6];
|
||||
invMatrix[2][1] = poseCalibPara.invRMatrix[7];
|
||||
invMatrix[2][2] = poseCalibPara.invRMatrix[8];
|
||||
for (int i = 0, i_max = objOps.size(); i < i_max; i++)
|
||||
for (int i = 0, i_max = (int)objOps.size(); i < i_max; i++)
|
||||
{
|
||||
SSG_EulerAngles euAngle = { objOps[i].centerPos.x_roll, objOps[i].centerPos.y_pitch, objOps[i].centerPos.z_yaw};
|
||||
double pose[3][3];
|
||||
@ -3995,7 +3999,7 @@ void sg_getBagPositionAndOrientation(
|
||||
{
|
||||
*errCode = SG_ERR_3D_DATA_INVLD;
|
||||
//释放内存
|
||||
for (int i = 0, i_max = cloudPts.size(); i < i_max; i++)
|
||||
for (int i = 0, i_max = (int)cloudPts.size(); i < i_max; i++)
|
||||
free(cloudPts[i].p3DPosition);
|
||||
return;
|
||||
}
|
||||
@ -4004,13 +4008,13 @@ void sg_getBagPositionAndOrientation(
|
||||
std::vector<SSG_peakRgnInfo> peakRgn;
|
||||
sg_getBagPosition(
|
||||
&cloudPts[0],
|
||||
cloudPts.size(),
|
||||
(int)cloudPts.size(),
|
||||
algoParam,
|
||||
poseCalibPara,
|
||||
peakRgn);
|
||||
|
||||
//释放内存
|
||||
for (int i = 0, i_max = cloudPts.size(); i < i_max; i++)
|
||||
for (int i = 0, i_max = (int)cloudPts.size(); i < i_max; i++)
|
||||
{
|
||||
#if OUTPUT_DEBUG
|
||||
std::vector< SVzNL3DPosition> out_line;
|
||||
@ -4030,7 +4034,7 @@ void sg_getBagPositionAndOrientation(
|
||||
//将颜色属性转成HSV
|
||||
HSV hsvPattern = RGBtoHSV(rgbColorPattern.r, rgbColorPattern.g, rgbColorPattern.b);
|
||||
//进行颜色统计处理:取centerPos为中心的(0.8*Width, 0.8*Height)的范围内的点进行统计
|
||||
int objNum = peakRgn.size();
|
||||
int objNum = (int)peakRgn.size();
|
||||
if (objNum > 0)
|
||||
{
|
||||
//以水平放置的矩阵为标准模型位置,即水平方向为长度,垂直方向为宽度
|
||||
@ -4140,7 +4144,7 @@ void sg_getBagPositionAndOrientation(
|
||||
else if (m == 3)
|
||||
int kkk = 1;
|
||||
double rx_abs = abs(rx);
|
||||
int hist_idx = rx_abs / x_slice[m];
|
||||
int hist_idx = (int)(rx_abs / x_slice[m]);
|
||||
if (hist_idx >= RGN_HIST_SIZE / 2)
|
||||
hist_idx = RGN_HIST_SIZE / 2 - 1;
|
||||
if (rx < 0)
|
||||
@ -4328,7 +4332,7 @@ void sg_sideBagPosition(
|
||||
std::vector< SSG_basicFeature1D> localPkTop;
|
||||
sg_getLineLocalPeaks(
|
||||
filterData.data(),
|
||||
filterData.size(),
|
||||
(int)filterData.size(),
|
||||
hLine,
|
||||
(algoParam.bagParam.bagH / 2),
|
||||
localPkBtm,
|
||||
@ -4376,7 +4380,7 @@ void sg_sideBagPosition(
|
||||
|
||||
//对top进行过滤
|
||||
std::vector<SSG_featureTree> h_trees_top;
|
||||
for (int i = 0, i_max = h_trees_top_all.size(); i < i_max; i++)
|
||||
for (int i = 0, i_max = (int)h_trees_top_all.size(); i < i_max; i++)
|
||||
{
|
||||
double w = h_trees_top_all[i].roi.right - h_trees_top_all[i].roi.left;
|
||||
if (w > algoParam.bagParam.bagW / 2)
|
||||
@ -4388,7 +4392,7 @@ void sg_sideBagPosition(
|
||||
|
||||
//确定顶层位置
|
||||
double topLayer_height = std::numeric_limits<double>::max(); //一个极大值
|
||||
for (int i = 0, i_max = h_trees_top.size(); i < i_max; i++)
|
||||
for (int i = 0, i_max = (int)h_trees_top.size(); i < i_max; i++)
|
||||
{
|
||||
double layer_h = (h_trees_top[i].roi.top + h_trees_top[i].roi.bottom) / 2;
|
||||
if (topLayer_height > layer_h)
|
||||
@ -4398,7 +4402,7 @@ void sg_sideBagPosition(
|
||||
///判断层间
|
||||
///寻找第一个位置最高的Tree,这个是编织袋的突出部,为一个纺织袋的中间
|
||||
std::vector<SSG_featureTree> hTree_top_first;
|
||||
for (int i = 0, i_max = h_trees_top.size(); i < i_max; i++)
|
||||
for (int i = 0, i_max = (int)h_trees_top.size(); i < i_max; i++)
|
||||
{
|
||||
double layer_h = (h_trees_top[i].roi.top + h_trees_top[i].roi.bottom) / 2;
|
||||
double layer_h_diff = layer_h - topLayer_height;
|
||||
@ -4413,7 +4417,7 @@ void sg_sideBagPosition(
|
||||
std::sort(hTree_top_first.begin(), hTree_top_first.end(), compareByXPos);
|
||||
//寻找与topLayer_height最近的bottom
|
||||
std::vector<SSG_featureTree> hTree_btm_first;
|
||||
for (int i = 0, i_max = h_trees_bottom.size(); i < i_max; i++)
|
||||
for (int i = 0, i_max = (int)h_trees_bottom.size(); i < i_max; i++)
|
||||
{
|
||||
double layer_h = (h_trees_bottom[i].roi.top + h_trees_bottom[i].roi.bottom) / 2;
|
||||
double layer_h_diff = layer_h - topLayer_height;
|
||||
@ -4423,11 +4427,11 @@ void sg_sideBagPosition(
|
||||
|
||||
//标注
|
||||
int treeId = 1000;
|
||||
for (int i = 0, i_max = hTree_top_first.size(); i < i_max; i++)
|
||||
for (int i = 0, i_max = (int)hTree_top_first.size(); i < i_max; i++)
|
||||
{
|
||||
treeId++;
|
||||
SSG_featureTree& a_tree = hTree_top_first[i];
|
||||
for (int j = 0, j_max = a_tree.treeNodes.size(); j < j_max; j++)
|
||||
for (int j = 0, j_max = (int)a_tree.treeNodes.size(); j < j_max; j++)
|
||||
{
|
||||
int lineIdx = a_tree.treeNodes[j].jumpPos2D.y;
|
||||
int ptIdx = a_tree.treeNodes[j].jumpPos2D.x;
|
||||
@ -4436,11 +4440,11 @@ void sg_sideBagPosition(
|
||||
}
|
||||
#if 1
|
||||
treeId = 2000;
|
||||
for (int i = 0, i_max = hTree_btm_first.size(); i < i_max; i++)
|
||||
for (int i = 0, i_max = (int)hTree_btm_first.size(); i < i_max; i++)
|
||||
{
|
||||
treeId++;
|
||||
SSG_featureTree& a_tree = hTree_btm_first[i];
|
||||
for (int j = 0, j_max = a_tree.treeNodes.size(); j < j_max; j++)
|
||||
for (int j = 0, j_max = (int)a_tree.treeNodes.size(); j < j_max; j++)
|
||||
{
|
||||
int lineIdx = a_tree.treeNodes[j].jumpPos2D.y;
|
||||
int ptIdx = a_tree.treeNodes[j].jumpPos2D.x;
|
||||
@ -4450,13 +4454,13 @@ void sg_sideBagPosition(
|
||||
#endif
|
||||
//生成目标数据
|
||||
int objId = 1;
|
||||
for (int i = 0, i_max = hTree_top_first.size(); i < i_max; i++)
|
||||
for (int i = 0, i_max = (int)hTree_top_first.size(); i < i_max; i++)
|
||||
{
|
||||
SSG_featureTree& a_tree = hTree_top_first[i];
|
||||
double center_x = (a_tree.roi.left + a_tree.roi.right) / 2;
|
||||
std::vector< SVzNL3DPoint> pkPts;
|
||||
SVzNL3DPoint objPt = { 0,0,0 }; //与center_x最近的点作为目标点。
|
||||
for (int j = 0, j_max = a_tree.treeNodes.size(); j < j_max; j++)
|
||||
for (int j = 0, j_max = (int)a_tree.treeNodes.size(); j < j_max; j++)
|
||||
{
|
||||
SVzNL3DPoint a_pt = a_tree.treeNodes[j].jumpPos;
|
||||
//a_pt.y = a_tree.treeNodes[j].jumpPos.x;
|
||||
@ -4484,10 +4488,10 @@ void sg_sideBagPosition(
|
||||
//计算抓取点
|
||||
SVzNL3DPoint pre_pt = { 0,0,0 };
|
||||
SVzNL3DPoint post_pt = { 0,0,0 };
|
||||
for (int m = 0, m_max = hTree_btm_first.size(); m < m_max; m++)
|
||||
for (int m = 0, m_max = (int)hTree_btm_first.size(); m < m_max; m++)
|
||||
{
|
||||
SSG_featureTree& a_btm_tree = hTree_btm_first[m];
|
||||
int node_size = a_btm_tree.treeNodes.size();
|
||||
int node_size = (int)a_btm_tree.treeNodes.size();
|
||||
if (node_size == 0)
|
||||
continue;
|
||||
|
||||
@ -4507,7 +4511,7 @@ void sg_sideBagPosition(
|
||||
}
|
||||
else
|
||||
{
|
||||
for (int n = 0, n_max = a_btm_tree.treeNodes.size(); n < n_max; n++)
|
||||
for (int n = 0, n_max = (int)a_btm_tree.treeNodes.size(); n < n_max; n++)
|
||||
{
|
||||
SSG_basicFeature1D& a_node = a_btm_tree.treeNodes[n];
|
||||
if (a_node.jumpPos.x <= center_x)
|
||||
@ -4613,7 +4617,7 @@ void sg_getSideBagStackBasePosition(
|
||||
std::vector< SSG_basicFeature1D> jumps;
|
||||
sg_getLineDownJumps(
|
||||
hLines[hLine].data(),
|
||||
hLines[hLine].size(),
|
||||
(int)hLines[hLine].size(),
|
||||
hLine,
|
||||
stackBaseParam.jumpTh,
|
||||
jumps);
|
||||
@ -4643,10 +4647,10 @@ void sg_getSideBagStackBasePosition(
|
||||
//根据长度进行进行配对
|
||||
std::vector<SSG_intPair> basePairs;
|
||||
std::vector<double> basePairYDist;
|
||||
for (int i = 0, i_max = h_trees_jumps.size(); i < i_max; i++)
|
||||
for (int i = 0, i_max = (int)h_trees_jumps.size(); i < i_max; i++)
|
||||
{
|
||||
SSG_featureTree& tree_1 = h_trees_jumps[i];
|
||||
int nodeSize = tree_1.treeNodes.size();
|
||||
int nodeSize = (int)tree_1.treeNodes.size();
|
||||
if(nodeSize <2)
|
||||
continue;
|
||||
SSG_basicFeature1D& node1_L = tree_1.treeNodes[0];
|
||||
@ -4658,7 +4662,7 @@ void sg_getSideBagStackBasePosition(
|
||||
for (int j = i + 1; j < i_max; j++)
|
||||
{
|
||||
SSG_featureTree& tree_2 = h_trees_jumps[j];
|
||||
int nodeSize_2 = tree_2.treeNodes.size();
|
||||
int nodeSize_2 = (int)tree_2.treeNodes.size();
|
||||
if (nodeSize_2 < 2)
|
||||
continue;
|
||||
SSG_basicFeature1D& node2_L = tree_2.treeNodes[0];
|
||||
@ -4702,7 +4706,7 @@ void sg_getSideBagStackBasePosition(
|
||||
|
||||
double minDist = basePairYDist[0];
|
||||
//挑选一个最佳的匹配
|
||||
for (int i = 1, i_max = basePairs.size(); i < i_max; i++)
|
||||
for (int i = 1, i_max = (int)basePairs.size(); i < i_max; i++)
|
||||
{
|
||||
if (minDist > basePairYDist[i])
|
||||
{
|
||||
@ -4720,7 +4724,7 @@ void sg_getSideBagStackBasePosition(
|
||||
//标注
|
||||
int treeId = 1;
|
||||
SSG_featureTree& a_tree = h_trees_jumps[bestOne.data_0];
|
||||
for (int j = 0, j_max = a_tree.treeNodes.size(); j < j_max; j++)
|
||||
for (int j = 0, j_max = (int)a_tree.treeNodes.size(); j < j_max; j++)
|
||||
{
|
||||
int lineIdx = a_tree.treeNodes[j].jumpPos2D.y;
|
||||
int ptIdx = a_tree.treeNodes[j].jumpPos2D.x;
|
||||
@ -4728,7 +4732,7 @@ void sg_getSideBagStackBasePosition(
|
||||
}
|
||||
treeId = 2;
|
||||
a_tree = h_trees_jumps[bestOne.data_1];
|
||||
for (int j = 0, j_max = a_tree.treeNodes.size(); j < j_max; j++)
|
||||
for (int j = 0, j_max = (int)a_tree.treeNodes.size(); j < j_max; j++)
|
||||
{
|
||||
int lineIdx = a_tree.treeNodes[j].jumpPos2D.y;
|
||||
int ptIdx = a_tree.treeNodes[j].jumpPos2D.x;
|
||||
|
||||
@ -71,10 +71,10 @@ SVzNL3DRangeD sg_getScanDataROI_vector(std::vector< std::vector<SVzNL3DPosition>
|
||||
roi.yRange = { 0, -1 };
|
||||
roi.zRange = { 0, -1 };
|
||||
|
||||
int lineNum = scanLines.size();
|
||||
int lineNum = (int)scanLines.size();
|
||||
for (int line = 0; line < lineNum; line++)
|
||||
{
|
||||
int nPositionCnt = scanLines[line].size();
|
||||
int nPositionCnt = (int)scanLines[line].size();
|
||||
for (int i = 0; i < nPositionCnt; i++)
|
||||
{
|
||||
SVzNL3DPosition* pt3D = &scanLines[line][i];
|
||||
@ -689,7 +689,7 @@ void vzCaculateLaserPlane(std::vector<cv::Point3f> Points3ds, std::vector<double
|
||||
A.at<double>(2, 1) = yi;
|
||||
A.at<double>(0, 2) = xi;
|
||||
A.at<double>(1, 2) = yi;
|
||||
A.at<double>(2, 2) = Points3ds.size();
|
||||
A.at<double>(2, 2) = (double)((int)Points3ds.size());
|
||||
B.at<double>(0, 0) = zixi;
|
||||
B.at<double>(1, 0) = ziyi;
|
||||
B.at<double>(2, 0) = zi;
|
||||
@ -1014,14 +1014,14 @@ SSG_planeCalibPara sg_getPlaneCalibPara(
|
||||
case 2: //下降
|
||||
if (z_diff > 0) // 上升
|
||||
{
|
||||
int pkBtmIdx = pkBtm.size();
|
||||
int pkBtmIdx = (int)pkBtm.size();
|
||||
pkBtmBackIndexing[pre_i] = pkBtmIdx;
|
||||
pkBtm.push_back({ pre_i, pre_data });
|
||||
_state = 1;
|
||||
}
|
||||
else if (i == (zHistSize - 1))
|
||||
{
|
||||
int pkBtmIdx = pkBtm.size();
|
||||
int pkBtmIdx = (int)pkBtm.size();
|
||||
pkBtmBackIndexing[i] = pkBtmIdx;
|
||||
pkBtm.push_back({ i, curr_data });
|
||||
}
|
||||
@ -1039,7 +1039,7 @@ SSG_planeCalibPara sg_getPlaneCalibPara(
|
||||
|
||||
int pntSizeTh = totalPntSize / 10;
|
||||
SSG_intPair* vldPeak = NULL;
|
||||
for (int i = 0, i_max = pkTop.size(); i < i_max; i++)
|
||||
for (int i = 0, i_max = (int)pkTop.size(); i < i_max; i++)
|
||||
{
|
||||
if (pkTop[i].data_1 > pntSizeTh)
|
||||
{
|
||||
@ -1102,9 +1102,9 @@ SSG_planeCalibPara sg_getPlaneCalibPara(
|
||||
if ((pt3D->pt3D.z >= topZRange.min) && (pt3D->pt3D.z <= topZRange.max))
|
||||
{
|
||||
cv::Point3f a_vldPt;
|
||||
a_vldPt.x = pt3D->pt3D.x;
|
||||
a_vldPt.y = pt3D->pt3D.y;
|
||||
a_vldPt.z = pt3D->pt3D.z;
|
||||
a_vldPt.x = (float)pt3D->pt3D.x;
|
||||
a_vldPt.y = (float)pt3D->pt3D.y;
|
||||
a_vldPt.z = (float)pt3D->pt3D.z;
|
||||
Points3ds.push_back(a_vldPt);
|
||||
}
|
||||
}
|
||||
@ -1169,7 +1169,7 @@ SSG_planeCalibPara sg_getPlaneCalibPara(
|
||||
//数据进行转换
|
||||
SVzNLRangeD calibZRange = { 0, -1 };
|
||||
topZRange = { 0, -1 };
|
||||
for (int i = 0, i_max = Points3ds.size(); i < i_max; i++)
|
||||
for (int i = 0, i_max = (int)Points3ds.size(); i < i_max; i++)
|
||||
{
|
||||
//z
|
||||
if (topZRange.max < topZRange.min)
|
||||
@ -1185,9 +1185,9 @@ SSG_planeCalibPara sg_getPlaneCalibPara(
|
||||
topZRange.max = Points3ds[i].z;
|
||||
}
|
||||
cv::Point3f a_calibPt;
|
||||
a_calibPt.x = Points3ds[i].x * planePara.planeCalib[0] + Points3ds[i].y * planePara.planeCalib[1] + Points3ds[i].z * planePara.planeCalib[2];
|
||||
a_calibPt.y = Points3ds[i].x * planePara.planeCalib[3] + Points3ds[i].y * planePara.planeCalib[4] + Points3ds[i].z * planePara.planeCalib[5];
|
||||
a_calibPt.z = Points3ds[i].x * planePara.planeCalib[6] + Points3ds[i].y * planePara.planeCalib[7] + Points3ds[i].z * planePara.planeCalib[8];
|
||||
a_calibPt.x = (float)(Points3ds[i].x * planePara.planeCalib[0] + Points3ds[i].y * planePara.planeCalib[1] + Points3ds[i].z * planePara.planeCalib[2]);
|
||||
a_calibPt.y = (float)(Points3ds[i].x * planePara.planeCalib[3] + Points3ds[i].y * planePara.planeCalib[4] + Points3ds[i].z * planePara.planeCalib[5]);
|
||||
a_calibPt.z = (float)(Points3ds[i].x * planePara.planeCalib[6] + Points3ds[i].y * planePara.planeCalib[7] + Points3ds[i].z * planePara.planeCalib[8]);
|
||||
//z
|
||||
if (calibZRange.max < calibZRange.min)
|
||||
{
|
||||
@ -1237,7 +1237,7 @@ SSG_planeCalibPara sg_getPlaneCalibPara_ROIs(
|
||||
continue;
|
||||
|
||||
bool isValid = false;
|
||||
for (int m = 0, m_max = ROIs.size(); m < m_max; m++)
|
||||
for (int m = 0, m_max = (int)ROIs.size(); m < m_max; m++)
|
||||
{
|
||||
if ((pt3D->pt3D.x >= ROIs[m].xRange.min) && (pt3D->pt3D.x <= ROIs[m].xRange.max) &&
|
||||
(pt3D->pt3D.y >= ROIs[m].yRange.min) && (pt3D->pt3D.y <= ROIs[m].yRange.max) &&
|
||||
@ -1251,9 +1251,9 @@ SSG_planeCalibPara sg_getPlaneCalibPara_ROIs(
|
||||
continue;
|
||||
|
||||
cv::Point3f a_vldPt;
|
||||
a_vldPt.x = pt3D->pt3D.x;
|
||||
a_vldPt.y = pt3D->pt3D.y;
|
||||
a_vldPt.z = pt3D->pt3D.z;
|
||||
a_vldPt.x = (float)pt3D->pt3D.x;
|
||||
a_vldPt.y = (float)pt3D->pt3D.y;
|
||||
a_vldPt.z = (float)pt3D->pt3D.z;
|
||||
Points3ds.push_back(a_vldPt);
|
||||
}
|
||||
}
|
||||
@ -1317,12 +1317,12 @@ SSG_planeCalibPara sg_getPlaneCalibPara_ROIs(
|
||||
#endif
|
||||
//数据进行转换
|
||||
SVzNLRangeD calibZRange = { 0, -1 };
|
||||
for (int i = 0, i_max = Points3ds.size(); i < i_max; i++)
|
||||
for (int i = 0, i_max = (int)Points3ds.size(); i < i_max; i++)
|
||||
{
|
||||
cv::Point3f a_calibPt;
|
||||
a_calibPt.x = Points3ds[i].x * planePara.planeCalib[0] + Points3ds[i].y * planePara.planeCalib[1] + Points3ds[i].z * planePara.planeCalib[2];
|
||||
a_calibPt.y = Points3ds[i].x * planePara.planeCalib[3] + Points3ds[i].y * planePara.planeCalib[4] + Points3ds[i].z * planePara.planeCalib[5];
|
||||
a_calibPt.z = Points3ds[i].x * planePara.planeCalib[6] + Points3ds[i].y * planePara.planeCalib[7] + Points3ds[i].z * planePara.planeCalib[8];
|
||||
a_calibPt.x = (float)(Points3ds[i].x * planePara.planeCalib[0] + Points3ds[i].y * planePara.planeCalib[1] + Points3ds[i].z * planePara.planeCalib[2]);
|
||||
a_calibPt.y = (float)(Points3ds[i].x * planePara.planeCalib[3] + Points3ds[i].y * planePara.planeCalib[4] + Points3ds[i].z * planePara.planeCalib[5]);
|
||||
a_calibPt.z = (float)(Points3ds[i].x * planePara.planeCalib[6] + Points3ds[i].y * planePara.planeCalib[7] + Points3ds[i].z * planePara.planeCalib[8]);
|
||||
//z
|
||||
if (calibZRange.max < calibZRange.min)
|
||||
{
|
||||
@ -1489,9 +1489,9 @@ void lineDataRT_RGBD(SVzNLXYZRGBDLaserLine* a_line, const double* camPoseR, doub
|
||||
double z = a_pt.x * camPoseR[6] + a_pt.y * camPoseR[7] + a_pt.z * camPoseR[8];
|
||||
if ((groundH > 0) && (z > groundH)) //去除地面
|
||||
z = 0;
|
||||
a_pt.x = x;
|
||||
a_pt.y = y;
|
||||
a_pt.z = z;
|
||||
a_pt.x = (float)x;
|
||||
a_pt.y = (float)y;
|
||||
a_pt.z = (float)z;
|
||||
a_line->p3DPoint[i] = a_pt;
|
||||
}
|
||||
return;
|
||||
|
||||
@ -16,7 +16,7 @@ void _seedClustering(
|
||||
break;
|
||||
|
||||
SVzNL3DPosition a_seed = a_cluster[i];
|
||||
for (int i = 0, i_max = pts.size(); i < i_max; i++)
|
||||
for (int i = 0, i_max = (int)pts.size(); i < i_max; i++)
|
||||
{
|
||||
if (pts[i].nPointIdx < 0)
|
||||
continue;
|
||||
@ -38,7 +38,7 @@ void sg_pointClustering(
|
||||
std::vector<std::vector< SVzNL3DPosition>>& objClusters //result
|
||||
)
|
||||
{
|
||||
int ptSize = pts.size();
|
||||
int ptSize = (int)pts.size();
|
||||
if (ptSize == 0)
|
||||
return;
|
||||
while(pts.size() > 0)
|
||||
@ -55,7 +55,7 @@ void sg_pointClustering(
|
||||
clusterDist);
|
||||
objClusters.push_back(a_cluster); //保存一个聚类
|
||||
//将pts中处理过的点去除
|
||||
int m_max = pts.size();
|
||||
int m_max = (int)pts.size();
|
||||
for (int m = m_max - 1; m >= 0; m--) //从后往前,这样删除不会影响循环
|
||||
{
|
||||
if(pts[m].nPointIdx < 0)
|
||||
|
||||
@ -54,7 +54,7 @@ bool _checkTypeMatch(int treeType, int featureType)
|
||||
//没有使用全匹配。一个feature一旦被匹配上,匹配就完成。没有使用最佳匹配。
|
||||
bool _featureGrowing(SSG_basicFeature1D& a_feature, const int lineIdx, std::vector<SSG_featureTree>& trees, SSG_treeGrowParam growParam)
|
||||
{
|
||||
for (int i = 0, i_max = trees.size(); i < i_max; i++)
|
||||
for (int i = 0, i_max = (int)trees.size(); i < i_max; i++)
|
||||
{
|
||||
SSG_featureTree& a_tree = trees[i];
|
||||
if (TREE_STATE_DEAD == a_tree.treeState)
|
||||
@ -187,7 +187,7 @@ bool _invalidateVSlopeTrees(SSG_featureTree& a_tree, double minLTypeTreeLen, dou
|
||||
else
|
||||
{
|
||||
//为了防止两端的点的扫描点的高度异常变化, 取中间段进行坡度计算
|
||||
int size = a_tree.treeNodes.size();
|
||||
int size = (int)a_tree.treeNodes.size();
|
||||
int pos_0 = size / 4;
|
||||
int pos_1 = size * 3 / 4;
|
||||
SSG_basicFeature1D* node_0 = &(a_tree.treeNodes[pos_0]);
|
||||
@ -224,7 +224,7 @@ void _growingFromHead(SSG_featureTree* a_tree, std::vector<SSG_lineFeature>& lin
|
||||
for (int i = head_line-1; i >= 0; i--)
|
||||
{
|
||||
SSG_lineFeature* a_line = &lineFeatures[i];
|
||||
int endingNum = a_line->endings.size();
|
||||
int endingNum = (int)a_line->endings.size();
|
||||
|
||||
bool growFlag = false;
|
||||
for (int m = 0; m < endingNum; m++)
|
||||
@ -254,7 +254,7 @@ void _growingFromTail(SSG_featureTree* a_tree, std::vector<SSG_lineFeature>& lin
|
||||
for (int i = tail_line + 1; i < lineFeatures.size(); i++)
|
||||
{
|
||||
SSG_lineFeature* a_line = &lineFeatures[i];
|
||||
int endingNum = a_line->endings.size();
|
||||
int endingNum = (int)a_line->endings.size();
|
||||
|
||||
bool growFlag = false;
|
||||
for (int m = 0; m < endingNum; m++)
|
||||
@ -294,7 +294,7 @@ void _getTreeROI(SSG_featureTree* a_tree)
|
||||
a_tree->roi.right = a_tree->treeNodes[0].jumpPos.x;
|
||||
a_tree->roi.top = a_tree->treeNodes[0].jumpPos.y;
|
||||
a_tree->roi.bottom = a_tree->treeNodes[0].jumpPos.y;
|
||||
for (int i = 1, i_max = a_tree->treeNodes.size(); i < i_max; i++)
|
||||
for (int i = 1, i_max = (int)a_tree->treeNodes.size(); i < i_max; i++)
|
||||
{
|
||||
if(a_tree->roi.left > a_tree->treeNodes[i].jumpPos.x)
|
||||
a_tree->roi.left = a_tree->treeNodes[i].jumpPos.x;
|
||||
@ -312,7 +312,7 @@ void _getTreeROI(SSG_featureTree* a_tree)
|
||||
SSG_featureTree* _getIncludingBigTree(SSG_featureTree* a_tree, std::vector<SSG_featureTree>& trees, bool chk_up)
|
||||
{
|
||||
SSG_featureTree* _bigTree = NULL;
|
||||
for (int i = 0, i_max = trees.size(); i < i_max; i++)
|
||||
for (int i = 0, i_max = (int)trees.size(); i < i_max; i++)
|
||||
{
|
||||
SSG_featureTree* chk_tree = &trees[i];
|
||||
if (a_tree == chk_tree)
|
||||
@ -361,12 +361,12 @@ void sg_getFeatureGrowingTrees(
|
||||
std::vector<SSG_featureTree>& trees,
|
||||
SSG_treeGrowParam growParam)
|
||||
{
|
||||
for (int i = 0, i_max = lineFeatures.size(); i < i_max; i++)
|
||||
for (int i = 0, i_max = (int)lineFeatures.size(); i < i_max; i++)
|
||||
{
|
||||
SSG_lineFeature& a_line = lineFeatures[i];
|
||||
if (a_line.features.size() > 0)
|
||||
{
|
||||
for (int j = 0, j_max = a_line.features.size(); j < j_max; j++)
|
||||
for (int j = 0, j_max = (int)a_line.features.size(); j < j_max; j++)
|
||||
{
|
||||
SSG_basicFeature1D& a_feature = a_line.features[j];
|
||||
if (a_feature.jumpPos2D.x == 207)
|
||||
@ -388,7 +388,7 @@ void sg_getFeatureGrowingTrees(
|
||||
//检查停止生长的树,加速。
|
||||
//将生长节点为1的生长树移除
|
||||
int lineIdx = a_line.lineIdx;
|
||||
int m_max = trees.size();
|
||||
int m_max = (int)trees.size();
|
||||
for (int m = m_max - 1; m >= 0; m--) //从后往前,这样删除不会影响循环
|
||||
{
|
||||
if (TREE_STATE_ALIVE == trees[m].treeState)
|
||||
@ -416,7 +416,7 @@ void sg_lineFeaturesGrowing(
|
||||
{
|
||||
if (features.size() > 0)
|
||||
{
|
||||
for (int j = 0, j_max = features.size(); j < j_max; j++)
|
||||
for (int j = 0, j_max = (int)features.size(); j < j_max; j++)
|
||||
{
|
||||
SSG_basicFeature1D& a_feature = features[j];
|
||||
if (a_feature.jumpPos2D.x== 207)
|
||||
@ -437,7 +437,7 @@ void sg_lineFeaturesGrowing(
|
||||
}
|
||||
//检查停止生长的树,加速。
|
||||
//将生长节点为1的生长树移除
|
||||
int m_max = trees.size();
|
||||
int m_max = (int)trees.size();
|
||||
for (int m = m_max - 1; m >= 0; m--) //从后往前,这样删除不会影响循环
|
||||
{
|
||||
if (TREE_STATE_ALIVE == trees[m].treeState)
|
||||
@ -463,7 +463,7 @@ void sg_getEndingGrowingTrees(
|
||||
std::vector<SSG_featureTree>& trees,
|
||||
SSG_treeGrowParam growParam)
|
||||
{
|
||||
for (int i = 0, i_max = lineEndings.size(); i < i_max; i++)
|
||||
for (int i = 0, i_max = (int)lineEndings.size(); i < i_max; i++)
|
||||
{
|
||||
if (i == 175)
|
||||
int kkk = 1;
|
||||
@ -496,7 +496,7 @@ void sg_getEndingGrowingTrees(
|
||||
//检查停止生长的树,加速。
|
||||
//将生长节点为1的生长树移除
|
||||
int lineIdx = an_ending.x;
|
||||
int m_max = trees.size();
|
||||
int m_max = (int)trees.size();
|
||||
for (int m = m_max - 1; m >= 0; m--) //从后往前,这样删除不会影响循环
|
||||
{
|
||||
if (TREE_STATE_ALIVE == trees[m].treeState)
|
||||
@ -531,14 +531,14 @@ void sg_LVFeatureGrowing(
|
||||
growParam);
|
||||
|
||||
//迭代一次:重新对每棵树头尾检查,看是否可以继续生长到LINE_EDGE
|
||||
for (int i = 0, i_max = trees.size(); i < i_max; i++)
|
||||
for (int i = 0, i_max = (int)trees.size(); i < i_max; i++)
|
||||
{
|
||||
SSG_featureTree* a_tree = &trees[i];
|
||||
|
||||
//Tree类型重新统计确定。
|
||||
std::vector<int> typeStat;
|
||||
typeStat.resize(LINE_FEATURE_NUM);
|
||||
for (int m = 0, m_max = a_tree->treeNodes.size(); m < m_max; m++)
|
||||
for (int m = 0, m_max = (int)a_tree->treeNodes.size(); m < m_max; m++)
|
||||
{
|
||||
int type = a_tree->treeNodes[m].featureType;
|
||||
typeStat[type]++;
|
||||
@ -564,7 +564,7 @@ void sg_LVFeatureGrowing(
|
||||
///两种过滤方法:
|
||||
///(1)针对SLOPE和V型生长树,检查生长方向和垂直方向的比例。
|
||||
///(2)宏观检查:检查短的生长树是否被长的生长树所包含
|
||||
int tree_size = trees.size();
|
||||
int tree_size = (int)trees.size();
|
||||
for (int m = tree_size - 1; m >= 0; m--) //从后往前,这样删除不会影响循环
|
||||
{
|
||||
SSG_featureTree* a_tree = &trees[m];
|
||||
@ -583,7 +583,7 @@ void sg_LVFeatureGrowing(
|
||||
}
|
||||
}
|
||||
}
|
||||
tree_size = trees.size();
|
||||
tree_size = (int)trees.size();
|
||||
for (int m = tree_size - 1; m >= 0; m--) //从后往前,这样删除不会影响循环
|
||||
{
|
||||
if (m == 24)
|
||||
@ -614,10 +614,10 @@ if (m == 24)
|
||||
std::vector<SSG_2DValueI> edge1_pts;
|
||||
std::vector<double> edge0_y;
|
||||
std::vector<double> edge1_y;
|
||||
for (int i = 0, i_max = lineFeatures.size(); i < i_max; i++)
|
||||
for (int i = 0, i_max = (int)lineFeatures.size(); i < i_max; i++)
|
||||
{
|
||||
SSG_lineFeature& a_line = lineFeatures[i];
|
||||
int a_line_endingNum = a_line.endings.size();
|
||||
int a_line_endingNum = (int)a_line.endings.size();
|
||||
if (a_line_endingNum > 0)
|
||||
{
|
||||
for (int m = 0; m < a_line_endingNum; m++)
|
||||
@ -672,7 +672,7 @@ void sg_getPeakGrowingTrees(
|
||||
std::vector<SSG_featureTree>& trees,
|
||||
SSG_treeGrowParam growParam)
|
||||
{
|
||||
for (int i = 0, i_max = peakFeatures.size(); i < i_max; i++)
|
||||
for (int i = 0, i_max = (int)peakFeatures.size(); i < i_max; i++)
|
||||
{
|
||||
int lineIdx = i;
|
||||
if (i == 761)
|
||||
@ -680,7 +680,7 @@ if (i == 761)
|
||||
std::vector< SSG_basicFeature1D>& a_linePeak = peakFeatures[i];
|
||||
if (a_linePeak.size() > 0)
|
||||
{
|
||||
for (int j = 0, j_max = a_linePeak.size(); j < j_max; j++)
|
||||
for (int j = 0, j_max = (int)a_linePeak.size(); j < j_max; j++)
|
||||
{
|
||||
SSG_basicFeature1D& a_feature = a_linePeak[j];
|
||||
if (a_feature.jumpPos2D.x == 207)
|
||||
@ -701,7 +701,7 @@ if (i == 761)
|
||||
}
|
||||
//检查停止生长的树,加速。
|
||||
//将生长节点为1的生长树移除
|
||||
int m_max = trees.size();
|
||||
int m_max = (int)trees.size();
|
||||
for (int m = m_max - 1; m >= 0; m--) //从后往前,这样删除不会影响循环
|
||||
{
|
||||
if (TREE_STATE_ALIVE == trees[m].treeState)
|
||||
@ -732,7 +732,7 @@ void sg_peakFeatureGrowing(
|
||||
trees,
|
||||
growParam);
|
||||
|
||||
for (int i = 0, i_max = trees.size(); i < i_max; i++)
|
||||
for (int i = 0, i_max = (int)trees.size(); i < i_max; i++)
|
||||
{
|
||||
SSG_featureTree* a_tree = &trees[i];
|
||||
_getTreeROI(a_tree);
|
||||
@ -789,7 +789,7 @@ int _featureGrowing_semiCircle(
|
||||
if ((FEATURE_FLAG_INVLD_START == a_feature.flag) || (FEATURE_FLAG_VALID_START == a_feature.flag))
|
||||
return -1;
|
||||
|
||||
for (int i = 0, i_max = trees.size(); i < i_max; i++)
|
||||
for (int i = 0, i_max = (int)trees.size(); i < i_max; i++)
|
||||
{
|
||||
SSG_semiCircleFeatureTree& a_tree = trees[i];
|
||||
if (TREE_STATE_DEAD == a_tree.treeState)
|
||||
@ -828,7 +828,7 @@ void sg_getFeatureGrowingTrees_semiCircle(
|
||||
std::vector<SSG_semiCircleFeatureTree>& invalidTrees,
|
||||
SSG_treeGrowParam growParam)
|
||||
{
|
||||
for (int i = 0, i_max = lineFeatures.size(); i < i_max; i++)
|
||||
for (int i = 0, i_max = (int)lineFeatures.size(); i < i_max; i++)
|
||||
{
|
||||
SSG_featureSemiCircle& a_feature = lineFeatures[i];
|
||||
if (FEATURE_FLAG_INVALID == a_feature.flag)
|
||||
@ -854,7 +854,7 @@ void sg_getFeatureGrowingTrees_semiCircle(
|
||||
double minDist = abs(a_feature.midPt.y - last_node.midPt.y);
|
||||
int bestMatch = i;
|
||||
//取最小的匹配
|
||||
for (int m = 0, m_max = otherMatching.size(); m < m_max; m++)
|
||||
for (int m = 0, m_max = (int)otherMatching.size(); m < m_max; m++)
|
||||
{
|
||||
int idx = otherMatching[m];
|
||||
double y_diff = abs(lineFeatures[idx].midPt.y - last_node.midPt.y);
|
||||
@ -865,7 +865,7 @@ void sg_getFeatureGrowingTrees_semiCircle(
|
||||
}
|
||||
}
|
||||
otherMatching.push_back(i);
|
||||
for (int m = 0, m_max = otherMatching.size(); m < m_max; m++)
|
||||
for (int m = 0, m_max = (int)otherMatching.size(); m < m_max; m++)
|
||||
{
|
||||
int idx = otherMatching[m];
|
||||
if (bestMatch == idx)
|
||||
@ -896,7 +896,7 @@ void sg_getFeatureGrowingTrees_semiCircle(
|
||||
}
|
||||
//检查停止生长的树,加速。
|
||||
//将生长节点为1的生长树移除
|
||||
int m_max = trees.size();
|
||||
int m_max = (int)trees.size();
|
||||
for (int m = m_max - 1; m >= 0; m--) //从后往前,这样删除不会影响循环
|
||||
{
|
||||
if (TREE_STATE_ALIVE == trees[m].treeState)
|
||||
|
||||
@ -70,7 +70,7 @@ void sg_lineDataSmoothing(
|
||||
output.resize(input.size()); // 预分配足够的空间
|
||||
std::copy(input.begin(), input.end(), output.begin());
|
||||
|
||||
int size = input.size();
|
||||
int size = (int)input.size();
|
||||
for (int i = 0; i < size; i++)
|
||||
{
|
||||
if (input[i].pt3D.z > 1e-4)
|
||||
@ -105,7 +105,7 @@ void sg_lineSegSmoothing(
|
||||
//output.resize(input.size()); // 预分配足够的空间
|
||||
//std::copy(input.begin(), input.end(), output.begin());
|
||||
|
||||
int dataSize = input.size();
|
||||
int dataSize = (int)input.size();
|
||||
//计算分段
|
||||
std::vector<std::vector<SVzNL3DPosition>> segs;
|
||||
std::vector<SVzNL3DPosition> a_seg;
|
||||
@ -144,7 +144,7 @@ void sg_lineSegSmoothing(
|
||||
segs.push_back(a_seg);
|
||||
|
||||
//分段平滑
|
||||
for (int i = 0, i_max = segs.size(); i < i_max; i++)
|
||||
for (int i = 0, i_max = (int)segs.size(); i < i_max; i++)
|
||||
{
|
||||
std::vector<SVzNL3DPosition> seg_output;
|
||||
sg_lineDataSmoothing(segs[i], smoothWin, seg_output);
|
||||
@ -196,7 +196,7 @@ if (i == 370)
|
||||
if(a_run.len > 0)
|
||||
continueRuns.push_back(a_run);
|
||||
|
||||
for (int i = 0, i_max = continueRuns.size(); i < i_max; i++)
|
||||
for (int i = 0, i_max = (int)continueRuns.size(); i < i_max; i++)
|
||||
{
|
||||
if (continueRuns[i].len < filterParam.outlierTh) //噪声
|
||||
{
|
||||
@ -253,7 +253,7 @@ void sg_lineDataRemoveOutlier_changeOriginData(
|
||||
if (a_run.len > 0)
|
||||
continueRuns.push_back(a_run);
|
||||
|
||||
for (int i = 0, i_max = continueRuns.size(); i < i_max; i++)
|
||||
for (int i = 0, i_max = (int)continueRuns.size(); i < i_max; i++)
|
||||
{
|
||||
if (continueRuns[i].len < filterParam.outlierTh) //噪声
|
||||
{
|
||||
@ -329,7 +329,7 @@ void sg_lineDataRemoveOutlier_ptDistMethod(SVzNL3DPosition* lineData, int dataSi
|
||||
if (a_run.len > 0)
|
||||
continueRuns.push_back(a_run);
|
||||
|
||||
for (int i = 0, i_max = continueRuns.size(); i < i_max; i++)
|
||||
for (int i = 0, i_max = (int)continueRuns.size(); i < i_max; i++)
|
||||
{
|
||||
if (continueRuns[i].len < filterParam.outlierTh) //噪声
|
||||
{
|
||||
@ -721,7 +721,7 @@ void sg_getLineLVFeature(SVzNL3DPosition* lineData, int dataSize, int lineIdx, c
|
||||
|
||||
//首先检查L型边界:本身具有足够坡度,与下一段形成明显坡度差
|
||||
//再检查是否可以形成V型特征
|
||||
for (int i = 0, i_max = slopes.size(); i < i_max; i++)
|
||||
for (int i = 0, i_max = (int)slopes.size(); i < i_max; i++)
|
||||
{
|
||||
SSG_slope* a_slope = &slopes[i];
|
||||
if (a_slope->flag > 0)
|
||||
@ -1093,7 +1093,7 @@ void sg_getLineLVFeature(SVzNL3DPosition* lineData, int dataSize, int lineIdx, c
|
||||
}
|
||||
}
|
||||
//检查连续的JUMP是否可能合并
|
||||
int i = line_features->features.size() - 2;
|
||||
int i = (int)line_features->features.size() - 2;
|
||||
while(i >= 0)
|
||||
{
|
||||
if (i < ((int)line_features->features.size() - 1))
|
||||
@ -1218,7 +1218,7 @@ void sg_getLineCornerFeature(
|
||||
//计算前向角和后向角
|
||||
std::vector< SSG_pntDirAngle> corners;
|
||||
corners.resize(vldPts.size());
|
||||
for (int i = 0, i_max = vldPts.size(); i < i_max; i++)
|
||||
for (int i = 0, i_max = (int)vldPts.size(); i < i_max; i++)
|
||||
{
|
||||
if ((lineIdx == 399) && (i == 419))
|
||||
int kkk = 1;
|
||||
@ -1279,7 +1279,7 @@ void sg_getLineCornerFeature(
|
||||
SSG_pntDirAngle* pre_data = NULL;
|
||||
std::vector< SSG_pntDirAngle> cornerPeakP;
|
||||
std::vector< SSG_pntDirAngle> cornerPeakM;
|
||||
for (int i = 0, i_max = vldPts.size(); i < i_max; i++)
|
||||
for (int i = 0, i_max = (int)vldPts.size(); i < i_max; i++)
|
||||
{
|
||||
if (i == 275)
|
||||
int kkk = 1;
|
||||
@ -1346,6 +1346,309 @@ void sg_getLineCornerFeature(
|
||||
}
|
||||
//注意:最后一个不处理,为基座位置
|
||||
|
||||
//极小值点(峰顶)
|
||||
//极值比较,在尺度窗口下寻找局部极值点
|
||||
double square_distTh = 4 * cornerPara.scale * cornerPara.scale; //2倍的cornerScale。
|
||||
for (int i = 0, i_max = (int)cornerPeakP.size(); i < i_max; i++)
|
||||
{
|
||||
if (cornerPeakP[i].corner < cornerPara.cornerTh)
|
||||
continue;
|
||||
|
||||
bool isPeak = true;
|
||||
//向前搜索
|
||||
int cornerPtIdx = cornerPeakP[i].pntIdx;
|
||||
for (int j = i - 1; j >= 0; j--)
|
||||
{
|
||||
int prePtIdx = cornerPeakP[j].pntIdx;
|
||||
double dist = pow(vldPts[cornerPtIdx].pt3D.y - vldPts[prePtIdx].pt3D.y, 2); // + pow(pkTop[i].pt3D.x - pkTop[j].pt3D.x, 2) ;
|
||||
if (dist > square_distTh) //超出尺度窗口
|
||||
break;
|
||||
|
||||
if (cornerPeakP[i].corner < cornerPeakP[j].corner)
|
||||
{
|
||||
isPeak = false;
|
||||
break;
|
||||
}
|
||||
}
|
||||
//向后搜索
|
||||
if (true == isPeak)
|
||||
{
|
||||
cornerPtIdx = cornerPeakP[i].pntIdx;
|
||||
for (int j = i + 1; j < i_max; j++)
|
||||
{
|
||||
int postPtIdx = cornerPeakP[j].pntIdx;
|
||||
double dist = pow(vldPts[cornerPtIdx].pt3D.y - vldPts[postPtIdx].pt3D.y, 2); // +pow(pkTop[i].pt3D.x - pkTop[j].pt3D.x, 2);
|
||||
if (dist > square_distTh) //超出尺度窗口
|
||||
break;
|
||||
|
||||
if (cornerPeakP[i].corner < cornerPeakP[j].corner)
|
||||
{
|
||||
isPeak = false;
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
if (true == isPeak)
|
||||
{
|
||||
SSG_basicFeature1D a_feature;
|
||||
if( (cornerPeakP[i].backwardAngle > cornerPara.jumpCornerTh_1) && (cornerPeakP[i].forwardAngle > -cornerPara.jumpCornerTh_2))
|
||||
a_feature.featureType = LINE_FEATURE_L_JUMP_H2L;
|
||||
else if ((cornerPeakP[i].forwardAngle < -cornerPara.jumpCornerTh_1) && (cornerPeakP[i].backwardAngle < cornerPara.jumpCornerTh_2))
|
||||
a_feature.featureType = LINE_FEATURE_L_JUMP_L2H;
|
||||
else
|
||||
a_feature.featureType = LINE_FEATURE_CORNER_V;
|
||||
|
||||
|
||||
a_feature.jumpPos = vldPts[cornerPtIdx].pt3D;
|
||||
a_feature.jumpPos2D = { lineIdx, vldPts[cornerPtIdx].nPointIdx };
|
||||
line_features->features.push_back(a_feature);
|
||||
}
|
||||
}
|
||||
|
||||
//添加开始和结束边界
|
||||
//检查seg是否需要合并;向后合并
|
||||
for (int i = 0, i_max = (int)segs.size(); i < i_max - 1; i++)
|
||||
{
|
||||
SSG_RUN* nxt_seg = &segs[i + 1];
|
||||
SSG_RUN* curr_seg = &segs[i];
|
||||
|
||||
int idx_1 = curr_seg->start + curr_seg->len - 1;
|
||||
int idx_2 = nxt_seg->start;
|
||||
double y_diff = abs(lineData[idx_1].pt3D.y - lineData[idx_2].pt3D.y);
|
||||
double z_diff = abs(lineData[idx_1].pt3D.z - lineData[idx_2].pt3D.z);
|
||||
if ( (y_diff < cornerPara.minEndingGap) && (z_diff < cornerPara.minEndingGap_z)) //合并
|
||||
{
|
||||
int idx_end = nxt_seg->start + nxt_seg->len - 1;
|
||||
nxt_seg->start = curr_seg->start;
|
||||
nxt_seg->len = idx_end - curr_seg->start + 1;
|
||||
curr_seg->value = 0;
|
||||
}
|
||||
}
|
||||
for (int i = 0, i_max = (int)segs.size(); i < i_max; i++)
|
||||
{
|
||||
if (0 == segs[i].value) //被合并
|
||||
continue;
|
||||
|
||||
int idx_1 = segs[i].start;
|
||||
int idx_2 = segs[i].start + segs[i].len - 1;
|
||||
|
||||
SSG_basicFeature1D an_edge;
|
||||
memset(&an_edge, 0, sizeof(SSG_basicFeature1D));
|
||||
an_edge.featureType = LINE_FEATURE_LINE_ENDING_0;
|
||||
an_edge.jumpPos = lineData[idx_1].pt3D;
|
||||
an_edge.jumpPos2D = { lineIdx, idx_1 };
|
||||
line_features->endings.push_back(an_edge);
|
||||
//line_features.insert(line_features.begin(), an_edge); //头部
|
||||
//尾部
|
||||
an_edge.featureType = LINE_FEATURE_LINE_ENDING_1;
|
||||
an_edge.jumpPos = lineData[idx_2].pt3D;
|
||||
an_edge.jumpPos2D = { lineIdx, idx_2 };
|
||||
line_features->endings.push_back(an_edge);
|
||||
}
|
||||
return;
|
||||
}
|
||||
|
||||
#if 0
|
||||
void sg_getLineCorners(
|
||||
std::vector<SVzNL3DPosition>& lineData,
|
||||
int lineIdx,
|
||||
const SSG_cornerParam cornerPara, //scale通常取bagH的1/4
|
||||
SSG_lineFeature* line_features)
|
||||
{
|
||||
line_features->lineIdx = lineIdx;
|
||||
if (lineIdx == 538)
|
||||
int kkk = 1;
|
||||
//去除零点
|
||||
std::vector< SVzNL3DPosition> vldPts;
|
||||
std::vector<SSG_RUN> segs;
|
||||
//修改seg的定义。seg端点是两点间距离大于门限的点
|
||||
int segStart = -1, segEnd = -1;
|
||||
int dataSize =
|
||||
for (int i = 0; i < dataSize; i++)
|
||||
{
|
||||
if ((lineIdx == 399) && (i == 568))
|
||||
int kkk = 1;
|
||||
SVzNL3DPosition a_pt = lineData[i];
|
||||
a_pt.nPointIdx = i;
|
||||
if (lineData[i].pt3D.z > 1e-4)
|
||||
vldPts.push_back(a_pt);
|
||||
|
||||
//seg判断
|
||||
if (lineData[i].pt3D.z > 1e-4)
|
||||
{
|
||||
if (segStart < 0)
|
||||
segStart = i;
|
||||
else //检查两点距离
|
||||
{
|
||||
SVzNL3DPosition pre_pt = lineData[i - 1];
|
||||
double diff_z = abs(a_pt.pt3D.z - pre_pt.pt3D.z);
|
||||
if (diff_z > cornerPara.minEndingGap_z)
|
||||
{
|
||||
SSG_RUN a_run;
|
||||
a_run.start = segStart;
|
||||
a_run.len = segEnd - segStart + 1;
|
||||
a_run.value = 1;
|
||||
segs.push_back(a_run);
|
||||
segStart = i;
|
||||
}
|
||||
}
|
||||
segEnd = i;
|
||||
}
|
||||
else
|
||||
{
|
||||
if (segStart >= 0)
|
||||
{
|
||||
SSG_RUN a_run;
|
||||
a_run.start = segStart;
|
||||
a_run.len = segEnd - segStart + 1;
|
||||
a_run.value = 1;
|
||||
segs.push_back(a_run);
|
||||
segStart = -1;
|
||||
segEnd = -1;
|
||||
}
|
||||
}
|
||||
}
|
||||
//last
|
||||
if (segStart >= 0)
|
||||
{
|
||||
SSG_RUN a_run;
|
||||
a_run.start = segStart;
|
||||
a_run.len = segEnd - segStart + 1;
|
||||
a_run.value = 1;
|
||||
segs.push_back(a_run);
|
||||
}
|
||||
|
||||
//计算前向角和后向角
|
||||
std::vector< SSG_pntDirAngle> corners;
|
||||
corners.resize(vldPts.size());
|
||||
for (int i = 0, i_max = vldPts.size(); i < i_max; i++)
|
||||
{
|
||||
if ((lineIdx == 399) && (i == 419))
|
||||
int kkk = 1;
|
||||
//前向寻找
|
||||
int pre_i = -1;
|
||||
for (int j = i - 1; j >= 0; j--)
|
||||
{
|
||||
double dist = sqrt(pow(vldPts[i].pt3D.y - vldPts[j].pt3D.y, 2) +
|
||||
pow(vldPts[i].pt3D.z - vldPts[j].pt3D.z, 2));
|
||||
if (dist >= cornerPara.scale)
|
||||
{
|
||||
pre_i = j;
|
||||
break;
|
||||
}
|
||||
}
|
||||
//后向寻找
|
||||
int post_i = -1;
|
||||
for (int j = i + 1; j < i_max; j++)
|
||||
{
|
||||
double dist = sqrt(pow(vldPts[i].pt3D.y - vldPts[j].pt3D.y, 2) +
|
||||
pow(vldPts[i].pt3D.z - vldPts[j].pt3D.z, 2));
|
||||
if (dist >= cornerPara.scale)
|
||||
{
|
||||
post_i = j;
|
||||
break;
|
||||
}
|
||||
}
|
||||
//计算拐角
|
||||
if ((pre_i < 0) || (post_i < 0))
|
||||
{
|
||||
corners[i].pntIdx = -1;
|
||||
corners[i].forwardAngle = 0;
|
||||
corners[i].backwardAngle = 0;
|
||||
corners[i].corner = 0;
|
||||
corners[i].forwardDiffZ = 0;
|
||||
corners[i].backwardDiffZ = 0;
|
||||
}
|
||||
else
|
||||
{
|
||||
double tanValue_pre = (vldPts[i].pt3D.z - vldPts[pre_i].pt3D.z) / abs(vldPts[i].pt3D.y - vldPts[pre_i].pt3D.y);
|
||||
double tanValue_post = (vldPts[post_i].pt3D.z - vldPts[i].pt3D.z) / abs(vldPts[post_i].pt3D.y - vldPts[i].pt3D.y);
|
||||
double forwardAngle = atan(tanValue_post) * 180.0 / PI;
|
||||
double backwardAngle = atan(tanValue_pre) * 180.0 / PI;
|
||||
corners[i].pntIdx = i;
|
||||
corners[i].forwardAngle = forwardAngle;
|
||||
corners[i].backwardAngle = backwardAngle;
|
||||
corners[i].corner = -(forwardAngle - backwardAngle); //图像坐标系与正常坐标系y方向相反,所以有“-”号
|
||||
corners[i].forwardDiffZ = vldPts[post_i].pt3D.z - vldPts[i].pt3D.z;
|
||||
corners[i].backwardDiffZ = vldPts[i].pt3D.z - vldPts[pre_i].pt3D.z;
|
||||
}
|
||||
}
|
||||
|
||||
//搜索拐角极值
|
||||
int _state = 0;
|
||||
int pre_i = -1;
|
||||
int sEdgePtIdx = -1;
|
||||
int eEdgePtIdx = -1;
|
||||
SSG_pntDirAngle* pre_data = NULL;
|
||||
std::vector< SSG_pntDirAngle> cornerPeakP;
|
||||
std::vector< SSG_pntDirAngle> cornerPeakM;
|
||||
for (int i = 0, i_max = vldPts.size(); i < i_max; i++)
|
||||
{
|
||||
if (i == 275)
|
||||
int kkk = 1;
|
||||
SSG_pntDirAngle* curr_data = &corners[i];
|
||||
if (curr_data->pntIdx < 0)
|
||||
{
|
||||
if (i == i_max - 1) //最后一个
|
||||
{
|
||||
if (1 == _state) //上升
|
||||
{
|
||||
cornerPeakP.push_back(corners[eEdgePtIdx]);
|
||||
}
|
||||
else if (2 == _state) //下降
|
||||
{
|
||||
cornerPeakM.push_back(corners[eEdgePtIdx]);
|
||||
}
|
||||
}
|
||||
continue;
|
||||
}
|
||||
|
||||
if (NULL == pre_data)
|
||||
{
|
||||
sEdgePtIdx = i;
|
||||
eEdgePtIdx = i;
|
||||
pre_data = curr_data;
|
||||
pre_i = i;
|
||||
continue;
|
||||
}
|
||||
|
||||
eEdgePtIdx = i;
|
||||
double cornerDiff = curr_data->corner - pre_data->corner;
|
||||
switch (_state)
|
||||
{
|
||||
case 0: //初态
|
||||
if (cornerDiff < 0) //下降
|
||||
{
|
||||
_state = 2;
|
||||
}
|
||||
else if (cornerDiff > 0) //上升
|
||||
{
|
||||
_state = 1;
|
||||
}
|
||||
break;
|
||||
case 1: //上升
|
||||
if (cornerDiff < 0) //下降
|
||||
{
|
||||
cornerPeakP.push_back(*pre_data);
|
||||
_state = 2;
|
||||
}
|
||||
break;
|
||||
case 2: //下降
|
||||
if (cornerDiff > 0) // 上升
|
||||
{
|
||||
cornerPeakM.push_back(*pre_data);
|
||||
_state = 1;
|
||||
}
|
||||
break;
|
||||
default:
|
||||
_state = 0;
|
||||
break;
|
||||
}
|
||||
pre_data = curr_data;
|
||||
pre_i = i;
|
||||
}
|
||||
//注意:最后一个不处理,为基座位置
|
||||
|
||||
//极小值点(峰顶)
|
||||
//极值比较,在尺度窗口下寻找局部极值点
|
||||
double square_distTh = 4 * cornerPara.scale * cornerPara.scale; //2倍的cornerScale。
|
||||
@ -1391,7 +1694,7 @@ void sg_getLineCornerFeature(
|
||||
if (true == isPeak)
|
||||
{
|
||||
SSG_basicFeature1D a_feature;
|
||||
if( (cornerPeakP[i].backwardAngle > cornerPara.jumpCornerTh_1) && (cornerPeakP[i].forwardAngle > -cornerPara.jumpCornerTh_2))
|
||||
if ((cornerPeakP[i].backwardAngle > cornerPara.jumpCornerTh_1) && (cornerPeakP[i].forwardAngle > -cornerPara.jumpCornerTh_2))
|
||||
a_feature.featureType = LINE_FEATURE_L_JUMP_H2L;
|
||||
else if ((cornerPeakP[i].forwardAngle < -cornerPara.jumpCornerTh_1) && (cornerPeakP[i].backwardAngle < cornerPara.jumpCornerTh_2))
|
||||
a_feature.featureType = LINE_FEATURE_L_JUMP_L2H;
|
||||
@ -1416,7 +1719,7 @@ void sg_getLineCornerFeature(
|
||||
int idx_2 = nxt_seg->start;
|
||||
double y_diff = abs(lineData[idx_1].pt3D.y - lineData[idx_2].pt3D.y);
|
||||
double z_diff = abs(lineData[idx_1].pt3D.z - lineData[idx_2].pt3D.z);
|
||||
if ( (y_diff < cornerPara.minEndingGap) && (z_diff < cornerPara.minEndingGap_z)) //ºÏ²¢
|
||||
if ((y_diff < cornerPara.minEndingGap) && (z_diff < cornerPara.minEndingGap_z)) //合并
|
||||
{
|
||||
int idx_end = nxt_seg->start + nxt_seg->len - 1;
|
||||
nxt_seg->start = curr_seg->start;
|
||||
@ -1447,7 +1750,7 @@ void sg_getLineCornerFeature(
|
||||
}
|
||||
return;
|
||||
}
|
||||
|
||||
#endif
|
||||
/// <summary>
|
||||
/// 提取激光线上的极值点(极大值点和极小值点)
|
||||
///
|
||||
@ -1539,7 +1842,7 @@ void sg_getLineLocalPeaks(
|
||||
//极小值点(峰顶)
|
||||
//极值比较,在尺度窗口下寻找局部极值点
|
||||
double square_distTh = scaleWin * scaleWin;
|
||||
for (int i = 0, i_max = pkTop.size(); i < i_max; i++)
|
||||
for (int i = 0, i_max = (int)pkTop.size(); i < i_max; i++)
|
||||
{
|
||||
bool isPeak = true;
|
||||
//向前搜索
|
||||
@ -1581,7 +1884,7 @@ void sg_getLineLocalPeaks(
|
||||
}
|
||||
}
|
||||
//极大值点(谷底)
|
||||
for (int i = 0, i_max = pkBtm.size(); i < i_max; i++)
|
||||
for (int i = 0, i_max = (int)pkBtm.size(); i < i_max; i++)
|
||||
{
|
||||
bool isPeak = true;
|
||||
//向前搜索
|
||||
@ -1921,7 +2224,7 @@ int _findSegMaxZPt(
|
||||
double* meanZ,
|
||||
bool* foundJump)
|
||||
{
|
||||
int dataSize = lineData.size();
|
||||
int dataSize = (int)lineData.size();
|
||||
double start_y = lineData[searchStart].pt3D.y;
|
||||
double start_z = lineData[searchStart].pt3D.z;
|
||||
if (start_z < 1e-4)
|
||||
@ -1978,7 +2281,7 @@ void sg_getFlatLineLocalPeaks_vector(
|
||||
const double holeR,
|
||||
std::vector< SSG_basicFeature1D>& localMax)
|
||||
{
|
||||
int dataSize = lineData.size();
|
||||
int dataSize = (int)lineData.size();
|
||||
if (dataSize < 2)
|
||||
return;
|
||||
|
||||
@ -1996,7 +2299,7 @@ void sg_getFlatLineLocalPeaks_vector(
|
||||
sampleData.push_back(a_sample);
|
||||
}
|
||||
|
||||
sampleNum = sampleData.size();
|
||||
sampleNum = (int)sampleData.size();
|
||||
std::vector< _FeatureInfo> allSubFeatures;
|
||||
allSubFeatures.resize(sampleNum);
|
||||
for (int i = 0; i < sampleNum; i++) //初始化
|
||||
@ -2160,7 +2463,7 @@ void sg_getFlatLineLocalPeaks_vector(
|
||||
featureBuffer.resize(vldFeatures.size());
|
||||
for (int i = 0; i < vldFeatures.size(); i++) //初始化
|
||||
featureBuffer[i].featureType = LINE_FEATURE_UNDEF;
|
||||
for (int i = 0, i_max = vldFeatures.size(); i < i_max; i++)
|
||||
for (int i = 0, i_max = (int)vldFeatures.size(); i < i_max; i++)
|
||||
{
|
||||
if (vldFeatures[i].type == LINE_FEATURE_L_JUMP_H2L)
|
||||
{
|
||||
@ -2320,7 +2623,7 @@ void sg_getFlatLineLocalPeaks_vector(
|
||||
}
|
||||
}
|
||||
//对SLOPE进行配对
|
||||
for (int i = 0, i_max = vldFeatures.size(); i < i_max; i++)
|
||||
for (int i = 0, i_max = (int)vldFeatures.size(); i < i_max; i++)
|
||||
{
|
||||
if (vldFeatures[i].type == LINE_FEATURE_L_SLOPE_L2H)
|
||||
{
|
||||
@ -2410,7 +2713,7 @@ void sg_getFlatLineLocalPeaks_vector(
|
||||
}
|
||||
|
||||
}
|
||||
for (int i = 0, i_max = vldFeatures.size(); i < i_max; i++)
|
||||
for (int i = 0, i_max = (int)vldFeatures.size(); i < i_max; i++)
|
||||
{
|
||||
if (featureBuffer[i].featureType != LINE_FEATURE_UNDEF)
|
||||
{
|
||||
@ -2586,7 +2889,7 @@ void sg_getLineUpperSemiCircleFeature(
|
||||
segs.push_back(a_run);
|
||||
}
|
||||
//检查seg是否需要合并;向后合并
|
||||
for (int i = 0, i_max = segs.size(); i < i_max - 1; i++)
|
||||
for (int i = 0, i_max = (int)segs.size(); i < i_max - 1; i++)
|
||||
{
|
||||
SSG_RUN* nxt_seg = &segs[i + 1];
|
||||
SSG_RUN* curr_seg = &segs[i];
|
||||
@ -2610,7 +2913,7 @@ void sg_getLineUpperSemiCircleFeature(
|
||||
endingFlag.resize(dataSize);
|
||||
for (int i = 0; i < dataSize; i++)
|
||||
endingFlag[i] = 0;
|
||||
for (int i = 0,i_max=segs.size(); i < i_max; i++)
|
||||
for (int i = 0,i_max= (int)segs.size(); i < i_max; i++)
|
||||
{
|
||||
if (0 == segs[i].value) //被合并
|
||||
continue;
|
||||
@ -2629,12 +2932,12 @@ void sg_getLineUpperSemiCircleFeature(
|
||||
slopePara.LSlopeZWin,
|
||||
segMax,
|
||||
segMin);
|
||||
for (int m = 0, m_max = segMax.size(); m < m_max; m++)
|
||||
for (int m = 0, m_max = (int)segMax.size(); m < m_max; m++)
|
||||
{
|
||||
segMax[m].jumpPos2D.y += idx_1;
|
||||
localMax.push_back(segMax[m]);
|
||||
}
|
||||
for (int m = 0, m_max = segMin.size(); m < m_max; m++)
|
||||
for (int m = 0, m_max = (int)segMin.size(); m < m_max; m++)
|
||||
{
|
||||
segMin[m].jumpPos2D.y += idx_1;
|
||||
localMin.push_back(segMin[m]);
|
||||
@ -2644,7 +2947,7 @@ void sg_getLineUpperSemiCircleFeature(
|
||||
//计算slope的Z变化
|
||||
std::vector< SSG_zWin> slopes; //记录窗口长度内的z变化
|
||||
slopes.resize(vldPts.size());
|
||||
for (int i = 0, i_max = vldPts.size(); i < i_max; i++)
|
||||
for (int i = 0, i_max = (int)vldPts.size(); i < i_max; i++)
|
||||
{
|
||||
//后向寻找
|
||||
int post_i = -1;
|
||||
@ -2683,7 +2986,7 @@ void sg_getLineUpperSemiCircleFeature(
|
||||
std::vector< SSG_zWin> zWinPeakM; //负的zWin
|
||||
SSG_zWin* maxPkPlus = NULL;
|
||||
SSG_zWin* maxPkMinus = NULL;
|
||||
for (int i = 0, i_max = vldPts.size(); i < i_max; i++)
|
||||
for (int i = 0, i_max = (int)vldPts.size(); i < i_max; i++)
|
||||
{
|
||||
if (i == 275)
|
||||
int kkk = 1;
|
||||
@ -2802,7 +3105,7 @@ void sg_getLineUpperSemiCircleFeature(
|
||||
//极值比较,在尺度窗口下寻找局部极值点
|
||||
std::vector<SSG_zWin> validZWinPeakP;
|
||||
double square_distTh = 4 * slopePara.LSlopeZWin * slopePara.LSlopeZWin; //2倍的cornerScale。
|
||||
for (int i = 0, i_max = zWinPeakP.size(); i < i_max; i++)
|
||||
for (int i = 0, i_max = (int)zWinPeakP.size(); i < i_max; i++)
|
||||
{
|
||||
if (zWinPeakP[i].zDiff < slopePara.validSlopeH)
|
||||
continue;
|
||||
@ -2855,7 +3158,7 @@ void sg_getLineUpperSemiCircleFeature(
|
||||
|
||||
//极值比较,在尺度窗口下寻找局部极值点
|
||||
std::vector<SSG_zWin> validZWinPeakM;
|
||||
for (int i = 0, i_max = zWinPeakM.size(); i < i_max; i++)
|
||||
for (int i = 0, i_max = (int)zWinPeakM.size(); i < i_max; i++)
|
||||
{
|
||||
if (zWinPeakM[i].zDiff > -slopePara.validSlopeH)
|
||||
continue;
|
||||
@ -2908,7 +3211,7 @@ void sg_getLineUpperSemiCircleFeature(
|
||||
|
||||
//对validCornerPeakP进行配对
|
||||
std::vector< SSG_featureSemiCircle> line_features;
|
||||
for (int i = 0, i_max = localMin.size(); i < i_max; i++)
|
||||
for (int i = 0, i_max = (int)localMin.size(); i < i_max; i++)
|
||||
{
|
||||
int ptIdx = localMin[i].jumpPos2D.y;
|
||||
if (endingFlag[ptIdx] > 0) //已经被处理
|
||||
@ -2952,7 +3255,7 @@ void sg_getLineUpperSemiCircleFeature(
|
||||
a_feature.lineIdx = lineIdx;
|
||||
a_feature.midPtIdx = _getYNearestPtIdx(lineData, preIdx, postIdx, midY);
|
||||
a_feature.midPt = lineData[a_feature.midPtIdx].pt3D;
|
||||
if (a_feature.midPtIdx >= 0);
|
||||
if (a_feature.midPtIdx >= 0)
|
||||
{
|
||||
int pkIdx = _getSegPeak(lineData, preIdx, postIdx);
|
||||
a_feature.pkHeight = lineData[pkIdx].pt3D.z;
|
||||
@ -2998,7 +3301,7 @@ void sg_getLineUpperSemiCircleFeature(
|
||||
}
|
||||
|
||||
//根据孔洞目标进行合并
|
||||
for (int i = 0, i_max = line_features.size(); i < i_max; i++)
|
||||
for (int i = 0, i_max = (int)line_features.size(); i < i_max; i++)
|
||||
{
|
||||
if (FEATURE_FLAG_INVALID == line_features[i].flag)
|
||||
continue;
|
||||
@ -3031,8 +3334,6 @@ void sg_getLineUpperSemiCircleFeature(
|
||||
return;
|
||||
}
|
||||
|
||||
|
||||
|
||||
//计算检查长度时使用街区距离以避免太多的平方和开方运算
|
||||
//如果z方向为Jump返回True。Jump定义Seed前一个点z的变化大于门限
|
||||
bool _getPtPreMaxDelta(
|
||||
|
||||
@ -127,7 +127,7 @@ void _getRgnVldContour(std::vector< SSG_2DValueI>& contourPts, std::vector< SSG_
|
||||
//游程分析
|
||||
std::vector< SSG_RUN> contourRuns;
|
||||
SSG_RUN a_run = { -1,-1,-1};
|
||||
for (int i = 0, i_max = contourPts.size(); i < i_max; i++)
|
||||
for (int i = 0, i_max = (int)contourPts.size(); i < i_max; i++)
|
||||
{
|
||||
SSG_2DValueI* a_pt = &contourPts[i];
|
||||
if (a_pt->x < 0)
|
||||
@ -172,7 +172,7 @@ void _getRgnVldContour(std::vector< SSG_2DValueI>& contourPts, std::vector< SSG_
|
||||
if (contourRuns.size() > 0)
|
||||
{
|
||||
//保留长的边界,小的短的边界可能是噪声
|
||||
for (int i = 0, i_max = contourRuns.size(); i < i_max; i++)
|
||||
for (int i = 0, i_max = (int)contourRuns.size(); i < i_max; i++)
|
||||
{
|
||||
SSG_RUN* curr_run = &contourRuns[i];
|
||||
if(curr_run->len > noiseRunLenTh)
|
||||
@ -180,7 +180,7 @@ void _getRgnVldContour(std::vector< SSG_2DValueI>& contourPts, std::vector< SSG_
|
||||
idIndexing[curr_run->value] = 1;
|
||||
}
|
||||
}
|
||||
for (int i = 0, i_max = contourPts.size(); i < i_max; i++)
|
||||
for (int i = 0, i_max = (int)contourPts.size(); i < i_max; i++)
|
||||
{
|
||||
SSG_2DValueI a_pt = contourPts[i];
|
||||
if (a_pt.x < 0)
|
||||
@ -222,10 +222,10 @@ void sg_getContourPts(
|
||||
//生成有效contour
|
||||
//统计block(遮挡)的比例
|
||||
int blockPtNum = 0;
|
||||
for (int m = 0, m_max = contour_all.size(); m < m_max; m++)
|
||||
for (int m = 0, m_max = (int)contour_all.size(); m < m_max; m++)
|
||||
{
|
||||
std::vector<SSG_contourPtInfo>& a_line_contourPts = contour_all[m].contourPts;
|
||||
for (int i = 0, i_max = a_line_contourPts.size(); i < i_max; i++)
|
||||
for (int i = 0, i_max = (int)a_line_contourPts.size(); i < i_max; i++)
|
||||
{
|
||||
SSG_contourPtInfo* a_contourPt = &a_line_contourPts[i];
|
||||
int an_edgeIdx = a_contourPt->edgeId;
|
||||
@ -260,10 +260,10 @@ void sg_getPairingContourPts(
|
||||
//统计block(遮挡)的比例
|
||||
int blockPtNum_0 = 0;
|
||||
int blockPtNum_1 = 0;
|
||||
for (int m = 0, m_max = contourPairs.size(); m < m_max; m++)
|
||||
for (int m = 0, m_max = (int)contourPairs.size(); m < m_max; m++)
|
||||
{
|
||||
SSG_conotourPair& a_ptPair = contourPairs[m];
|
||||
for (int i = 0, i_max = idPairs.size(); i < i_max; i++)
|
||||
for (int i = 0, i_max = (int)idPairs.size(); i < i_max; i++)
|
||||
{
|
||||
SSG_intPair& a_idPair = idPairs[i];
|
||||
if ( (a_ptPair.edgeId_0 == a_idPair.data_0) &&
|
||||
@ -294,7 +294,7 @@ void sg_getPairingContourPts(
|
||||
}
|
||||
}
|
||||
}
|
||||
int totalNum = contourFilter.size();
|
||||
int totalNum = (int)contourFilter.size();
|
||||
if(blockPtNum_0 > totalNum/2)
|
||||
*lowLevelFlag_0 = 1;
|
||||
if (blockPtNum_1 > totalNum / 2)
|
||||
@ -314,7 +314,7 @@ void sg_contourPostProc(std::vector< SSG_contourPtInfo>& contour, int maxEdgeIdx
|
||||
std::vector< SSG_contourEdgeInfo> edgeInfo;
|
||||
edgeInfo.resize(maxEdgeIdx + 1);
|
||||
std::vector<int> egdeIndexing;
|
||||
for (int i = 0, i_max = contour.size(); i < i_max; i++)
|
||||
for (int i = 0, i_max = (int)contour.size(); i < i_max; i++)
|
||||
{
|
||||
SSG_contourPtInfo* a_contourPt = &contour[i];
|
||||
int edgeIdx = a_contourPt->edgeId;
|
||||
@ -372,7 +372,7 @@ void sg_contourPostProc(std::vector< SSG_contourPtInfo>& contour, int maxEdgeIdx
|
||||
double dist_diff = scanDist - minScanDist;
|
||||
if (dist_diff < sameConturDistTh)
|
||||
{
|
||||
for (int m = 0, m_max = contour.size(); m < m_max; m++)
|
||||
for (int m = 0, m_max = (int)contour.size(); m < m_max; m++)
|
||||
{
|
||||
SSG_contourPtInfo* a_contourPt = &contour[m];
|
||||
int an_edgeIdx = a_contourPt->edgeId;
|
||||
@ -945,7 +945,7 @@ if (x == 0)
|
||||
break;
|
||||
else
|
||||
{
|
||||
for (int m = 0, m_max = a_line_upEdgePts.size(); m < m_max; m++)
|
||||
for (int m = 0, m_max = (int)a_line_upEdgePts.size(); m < m_max; m++)
|
||||
{
|
||||
if (*maxEdgeId_top < a_line_upEdgePts[m].edgeId)
|
||||
*maxEdgeId_top = a_line_upEdgePts[m].edgeId;
|
||||
@ -956,7 +956,7 @@ if (x == 0)
|
||||
topContour.insert(topContour.begin(), _line_upContours);
|
||||
}
|
||||
|
||||
for (int m = 0, m_max = a_line_downEdgePts.size(); m < m_max; m++)
|
||||
for (int m = 0, m_max = (int)a_line_downEdgePts.size(); m < m_max; m++)
|
||||
{
|
||||
if (*maxEdgeId_btm < a_line_downEdgePts[m].edgeId)
|
||||
*maxEdgeId_btm = a_line_downEdgePts[m].edgeId;
|
||||
@ -1012,7 +1012,7 @@ if (x == 34)
|
||||
break;
|
||||
else
|
||||
{
|
||||
for (int m = 0, m_max = a_line_upEdgePts.size(); m < m_max; m++)
|
||||
for (int m = 0, m_max = (int)a_line_upEdgePts.size(); m < m_max; m++)
|
||||
{
|
||||
if (*maxEdgeId_top < a_line_upEdgePts[m].edgeId)
|
||||
*maxEdgeId_top = a_line_upEdgePts[m].edgeId;
|
||||
@ -1023,7 +1023,7 @@ if (x == 34)
|
||||
topContour.push_back(_line_upContours);
|
||||
}
|
||||
|
||||
for (int m = 0, m_max = a_line_downEdgePts.size(); m < m_max; m++)
|
||||
for (int m = 0, m_max = (int)a_line_downEdgePts.size(); m < m_max; m++)
|
||||
{
|
||||
if (*maxEdgeId_btm < a_line_downEdgePts[m].edgeId)
|
||||
*maxEdgeId_btm = a_line_downEdgePts[m].edgeId;
|
||||
@ -1083,7 +1083,7 @@ if (y == 380)
|
||||
break;
|
||||
else
|
||||
{
|
||||
for (int m = 0, m_max = a_line_leftPts.size(); m < m_max; m++)
|
||||
for (int m = 0, m_max = (int)a_line_leftPts.size(); m < m_max; m++)
|
||||
{
|
||||
if (*maxEdgeId_left < a_line_leftPts[m].edgeId)
|
||||
*maxEdgeId_left = a_line_leftPts[m].edgeId;
|
||||
@ -1093,7 +1093,7 @@ if (y == 380)
|
||||
SSG_lineConotours _line_leftContours = { y, a_line_leftPts };
|
||||
leftContour.insert(leftContour.begin(), _line_leftContours);
|
||||
}
|
||||
for (int m = 0, m_max = a_line_rightPts.size(); m < m_max; m++)
|
||||
for (int m = 0, m_max = (int)a_line_rightPts.size(); m < m_max; m++)
|
||||
{
|
||||
if (*maxEdgeId_right < a_line_rightPts[m].edgeId)
|
||||
*maxEdgeId_right = a_line_rightPts[m].edgeId;
|
||||
@ -1149,7 +1149,7 @@ if (y == 380)
|
||||
break;
|
||||
else
|
||||
{
|
||||
for (int m = 0, m_max = a_line_leftPts.size(); m < m_max; m++)
|
||||
for (int m = 0, m_max = (int)a_line_leftPts.size(); m < m_max; m++)
|
||||
{
|
||||
if (*maxEdgeId_left < a_line_leftPts[m].edgeId)
|
||||
*maxEdgeId_left = a_line_leftPts[m].edgeId;
|
||||
@ -1159,7 +1159,7 @@ if (y == 380)
|
||||
SSG_lineConotours _line_leftContours = { y, a_line_leftPts };
|
||||
leftContour.push_back( _line_leftContours);
|
||||
}
|
||||
for (int m = 0, m_max = a_line_rightPts.size(); m < m_max; m++)
|
||||
for (int m = 0, m_max = (int)a_line_rightPts.size(); m < m_max; m++)
|
||||
{
|
||||
if (*maxEdgeId_right < a_line_rightPts[m].edgeId)
|
||||
*maxEdgeId_right = a_line_rightPts[m].edgeId;
|
||||
@ -1179,11 +1179,11 @@ float EDistance(int x1, int y1, int x2, int y2)
|
||||
}
|
||||
float MDistance(int x1, int y1, int x2, int y2)
|
||||
{
|
||||
return abs(x1 - x2) + abs(y1 - y2);
|
||||
return (float)abs(x1 - x2) + (float)abs(y1 - y2);
|
||||
}
|
||||
float CDistance(int x1, int y1, int x2, int y2)
|
||||
{
|
||||
return std::max(abs(x1 - x2), abs(y1 - y2));
|
||||
return std::max((float)abs(x1 - x2), (float)abs(y1 - y2));
|
||||
}
|
||||
float Distance(int x1, int y1, int x2, int y2, int type)
|
||||
{
|
||||
@ -1195,7 +1195,7 @@ float Distance(int x1, int y1, int x2, int y2, int type)
|
||||
{
|
||||
return MDistance(x1, y1, x2, y2);
|
||||
}
|
||||
else if (type == 2)
|
||||
else //if (type == 2)
|
||||
{
|
||||
return CDistance(x1, y1, x2, y2);
|
||||
}
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user