Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- std::pair<cv::Point, double> FindMaxInscribedCircle(const std::vector<cv::Point> &poly_contour, const cv::Mat &img)
- {
- std::pair<cv::Point, double> circle;
- double radius = -1;
- for (int i = 0; i < img.cols; i += 10) {
- for (int j = 0; j < img.rows; j += 10) {
- double distance = cv::pointPolygonTest(poly_contour, cv::Point(i, j), true);
- if (distance > radius) {
- radius = distance;
- circle.first = cv::Point(i, j);
- }
- }
- }
- circle.second = radius;
- return circle;
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement