void WindowManager::ProcessWindowData(WindowItemPtr ptr) { Size2f sz = Size2f::Cast(screenSize_); WindowItemRenderer renderer(Rectangle2f{Point2d(), sz.x(), sz.y()}); ptr->Accept(renderer); WindowImpl impl(renderer.GetData()); windows_.emplace(impl.Id(), impl); }
bool CustomPattern::create(InputArray pattern, const Size2f boardSize, OutputArray output) { CV_Assert(!pattern.empty() && (boardSize.area() > 0)); Mat img = pattern.getMat(); float pixel_size = (boardSize.width > boardSize.height)? // Choose the longer side for more accurate calculation float(img.cols) / boardSize.width: // width is longer float(img.rows) / boardSize.height; // height is longer return init(img, pixel_size, output); }
//finding the largest rectangle among the qualified RotatedRect GateDetector::FindLargestCandidate(vector<RotatedRect>& postCandidates) { RotatedRect largestCandidate; if (postCandidates.size() > 0) { Size2f s = postCandidates[0].size; size_t pl = 0; for (size_t i = 0; i < postCandidates.size(); i++) { if (postCandidates[i].size.area() > s.area()) { pl = i; s = postCandidates[i].size; } } largestCandidate = postCandidates[pl]; return largestCandidate; } return largestCandidate; }