Fix inlier assignment in Hungarian algorithm

While checking whether a match is a real match, the index of the corresponding column (row) for a row (column) is checked. The limit should be the number of the real columns (rows) for a given row (column).
This commit is contained in:
yigitsoy 2015-11-03 15:37:49 +01:00
parent b3ac274617
commit 16a3773a34

View File

@ -763,7 +763,7 @@ void SCDMatcher::hungarian(cv::Mat &costMatrix, std::vector<cv::DMatch> &outMatc
inliers1.reserve(sizeScd1);
for (size_t kc = 0; kc<inliers1.size(); kc++)
{
if (rowsol[kc]<sizeScd1) // if a real match
if (rowsol[kc]<sizeScd2) // if a real match
inliers1[kc]=1;
else
inliers1[kc]=0;
@ -771,7 +771,7 @@ void SCDMatcher::hungarian(cv::Mat &costMatrix, std::vector<cv::DMatch> &outMatc
inliers2.reserve(sizeScd2);
for (size_t kc = 0; kc<inliers2.size(); kc++)
{
if (colsol[kc]<sizeScd2) // if a real match
if (colsol[kc]<sizeScd1) // if a real match
inliers2[kc]=1;
else
inliers2[kc]=0;