remove filter fix

This commit is contained in:
Alex 2023-11-13 10:49:19 +03:00
parent 9b97c97bd1
commit 9c86d68b4c

View File

@ -4476,25 +4476,14 @@ static
vector<QRCode> analyzeFinderPatterns(const vector<vector<Point2f> > &corners, const Mat& img, vector<QRCode> analyzeFinderPatterns(const vector<vector<Point2f> > &corners, const Mat& img,
const QRCodeDetectorAruco::Params& qrDetectorParameters) { const QRCodeDetectorAruco::Params& qrDetectorParameters) {
vector<QRCode> qrCodes; vector<QRCode> qrCodes;
vector<FinderPatternInfo> patterns; vector<FinderPatternInfo> patterns(corners.size());
if (img.empty()) if (img.empty())
return qrCodes; return qrCodes;
float maxModuleSize = 0.f; float maxModuleSize = 0.f;
for (size_t i = 0ull; i < corners.size(); i++) { for (size_t i = 0ull; i < corners.size(); i++) {
FinderPatternInfo pattern = FinderPatternInfo(corners[i]); FinderPatternInfo pattern = FinderPatternInfo(corners[i]);
// TODO: improve thinning Aruco markers patterns[i] = pattern;
bool isUniq = true; maxModuleSize = max(maxModuleSize, pattern.moduleSize);
for (const FinderPatternInfo& tmp : patterns) {
Point2f dist = pattern.center - tmp.center;
if (max(abs(dist.x), abs(dist.y)) < 3.f * tmp.moduleSize) {
isUniq = false;
break;
}
}
if (isUniq) {
patterns.push_back(pattern);
maxModuleSize = max(maxModuleSize, patterns.back().moduleSize);
}
} }
const int threshold = cvRound(qrDetectorParameters.minModuleSizeInPyramid * 12.5f) + const int threshold = cvRound(qrDetectorParameters.minModuleSizeInPyramid * 12.5f) +
(cvRound(qrDetectorParameters.minModuleSizeInPyramid * 12.5f) % 2 ? 0 : 1); (cvRound(qrDetectorParameters.minModuleSizeInPyramid * 12.5f) % 2 ? 0 : 1);