Advertisement
Guest User

Untitled

a guest
Jun 29th, 2017
61
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.55 KB | None | 0 0
  1. std::pair<cv::Point, double> FindMaxInscribedCircle(const std::vector<cv::Point> &poly_contour, const cv::Mat &img)
  2. {
  3. std::pair<cv::Point, double> circle;
  4. double radius = -1;
  5.  
  6. for (int i = 0; i < img.cols; i += 10) {
  7. for (int j = 0; j < img.rows; j += 10) {
  8. double distance = cv::pointPolygonTest(poly_contour, cv::Point(i, j), true);
  9. if (distance > radius) {
  10. radius = distance;
  11. circle.first = cv::Point(i, j);
  12. }
  13. }
  14. }
  15.  
  16. circle.second = radius;
  17.  
  18. return circle;
  19. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement