zoukankan      html  css  js  c++  java
  • 凸包,二值图家矩形框

     1 #include <opencv2/opencv.hpp>  
     2 using namespace cv;
     3 using namespace std;
     4 int main()
     5 {
     6     Mat bwImg, srcImg, bwImg1;
     7     srcImg = imread("b.jpg",0);
     8      bwImg = srcImg > 100;
     9     vector<vector<Point>> contours;
    10     // 查找轮廓,对应连通域
    11     findContours(bwImg, contours, CV_RETR_EXTERNAL, CV_CHAIN_APPROX_NONE);
    12     //矩形标记
    13     for (size_t i = 0; i < contours.size(); i++)
    14     {
    15         Rect r = boundingRect(contours[i]);
    16         rectangle(bwImg, r, Scalar(200,0,0));
    17     }
    18 
    19     imshow("largest region", bwImg);
    20     waitKey();
    21     return 0;
    22 }

           

  • 相关阅读:
    排序
    wine-qq 安装
    逆元模板
    最长上升子序列
    SGU[115] Calendar
    SGU[123] The sum
    SGU[105] Div 3
    SGU[102] Coprimes
    SGU[100] A+B
    poj-1325-Machine Schedule
  • 原文地址:https://www.cnblogs.com/hsy1941/p/7729662.html
Copyright © 2011-2022 走看看