zoukankan      html  css  js  c++  java
  • opencv画出轮廓外接矩形

     1     Mat cannyImage;
     2     /// Detect edges using canny
     3     Canny(src, cannyImage, 125, 250, 3);
     4     vector<vector<Point> > contours;
     5     vector<Vec4i> hierarchy;
     6     /// Find contours
     7     findContours(cannyImage, contours, hierarchy, CV_RETR_EXTERNAL /* CV_RETR_EXTERNAL CV_RETR_LIST CV_RETR_CCOMP RETR_TREE CV_RETR_FLOODFILL*/, CHAIN_APPROX_SIMPLE, Point(0, 0));
     8 
     9     /// Approximate contours to polygons + get bounding rects and circles
    10     vector<vector<Point> > contours_poly(contours.size());
    11     vector<Rect> boundRect(contours.size());
    12 
    13     for (size_t i = 0; i < contours.size(); i++)
    14     {
    15         approxPolyDP(Mat(contours[i]), contours_poly[i], 3, true);
    16         boundRect[i] = boundingRect(Mat(contours_poly[i]));
    17     }
  • 相关阅读:
    miragejs 学习
    json-server学习
    react-redux
    webpack4知识汇总2
    webpack4知识汇总1
    vue跳转当前页面
    redux初识
    react知识补漏2
    vue ssr
    状态码
  • 原文地址:https://www.cnblogs.com/supercxm/p/8458980.html
Copyright © 2011-2022 走看看