SLAM惯用代码学习
参考链接1 ORB-SLAM2 代码块1.1 直方图投票机制
参考链接
暂时无
1 ORB-SLAM2 代码块
1.1 直方图投票机制
const int ORBmatcher
::HISTO_LENGTH
= 30;
-----------------------------------------------------------------
vector
<int> rotHist
[HISTO_LENGTH
];
for(int i
=0;i
<HISTO_LENGTH
;i
++)
rotHist
[i
].reserve(500);
const float factor
= HISTO_LENGTH
/360.0f;
----------------------------------------------------------------
if(mbCheckOrientation
)
{
float rot
= LastFrame
.mvKeysUn
[i
].angle
-CurrentFrame
.mvKeysUn
[bestIdx2
].angle
;
if(rot
<0.0)
rot
+=360.0f;
int bin
= round(rot
*factor
);
if(bin
==HISTO_LENGTH
)
bin
=0;
assert(bin
>=0 && bin
<HISTO_LENGTH
);
rotHist
[bin
].push_back(bestIdx2
);
}
----------------------------------------------------
if(mbCheckOrientation
)
{
int ind1
=-1;
int ind2
=-1;
int ind3
=-1;
ComputeThreeMaxima(rotHist
,HISTO_LENGTH
,ind1
,ind2
,ind3
);
for(int i
=0; i
<HISTO_LENGTH
; i
++)
{
if(i
!=ind1
&& i
!=ind2
&& i
!=ind3
)
{
for(size_t j
=0, jend
=rotHist
[i
].size(); j
<jend
; j
++)
{
CurrentFrame
.mvpMapPoints
[rotHist
[i
][j
]]=static_cast<MapPoint
*>(NULL);
nmatches
--;
}
}
}
}
转载请注明原文地址: https://mac.8miu.com/read-510543.html