std::map<int, Quad> find(const cv::Mat &inputImage){ auto greyscaleImage = mEnsureGreyscale(inputImage); std::map<int, Quad> tags; for (const auto & quad : mFindQuads(greyscaleImage)) { auto refinedQuad = mRefine(greyscaleImage, quad); auto tag = mDecode(mReadBits(greyscaleImage, refinedQuad), refinedQuad); if (tag.first != Decode::INVALID_TAG) tags[tag.first] = tag.second; else { tag = mDecode(mReadBits(greyscaleImage, quad), quad); if (tag.first != Decode::INVALID_TAG) tags[tag.first] = tag.second; } } return mFilter(tags); };
void Detect::doDetection(TagCornerMap& tags) { if(mRefineCorners) { for(const auto& quad : mFindQuads(mFrame)) { auto refinedQuad = mRefine(mFrame, quad, 1.5f/10.0f); auto tag = mDecode(mReadBits(mFrame, refinedQuad), refinedQuad); if(tag.first != Decode::INVALID_TAG) tags[tag.first] = tag.second; else{ tag = mDecode(mReadBits(mFrame, quad), quad); if(tag.first != Decode::INVALID_TAG) tags[tag.first] = tag.second; } } } else{ for(const auto& quad : mFindQuads(mFrame)) { auto tag = mDecode(mReadBits(mFrame, quad), quad); if(tag.first != Decode::INVALID_TAG) tags[tag.first] = tag.second; } } }