Merge pull request #3587 from vpradeep07:fix/pnpransac_race_cond

This commit is contained in:
Vadim Pisarevsky 2015-01-29 12:12:18 +00:00
commit 7e1068919b

View File

@ -196,18 +196,16 @@ namespace cv
} }
} }
resultsMutex.lock();
if (localInliers.size() > inliers.size()) if (localInliers.size() > inliers.size())
{ {
resultsMutex.lock();
inliers.clear(); inliers.clear();
inliers.resize(localInliers.size()); inliers.resize(localInliers.size());
memcpy(&inliers[0], &localInliers[0], sizeof(int) * localInliers.size()); memcpy(&inliers[0], &localInliers[0], sizeof(int) * localInliers.size());
localRvec.copyTo(rvec); localRvec.copyTo(rvec);
localTvec.copyTo(tvec); localTvec.copyTo(tvec);
resultsMutex.unlock();
} }
resultsMutex.unlock();
} }
static void pnpTask(const vector<char>& pointsMask, const Mat& objectPoints, const Mat& imagePoints, static void pnpTask(const vector<char>& pointsMask, const Mat& objectPoints, const Mat& imagePoints,