码迷,mamicode.com
首页 > 其他好文 > 详细

滤出轮廓中较大或者较小的

时间:2018-01-24 22:10:04      阅读:164      评论:0      收藏:0      [点我收藏+]

标签:gpo   col   ras   end   tor   max   put   while   output   

 //查找轮廓    
    int cmin = 10;     // 轮廓最短值
    int cmax = 1000;    // 轮廓最长值
    findContours( canny_output, contours, hierarchy, CV_RETR_TREE, CV_CHAIN_APPROX_SIMPLE, Point(0, 0) );     
    std::vector<std::vector<cv::Point>>::const_iterator itc = contours.begin();
    while (itc != contours.end())   //清楚图像的噪声点
    {
        // 移除过长或过短的轮廓
        if (itc->size() < cmin || itc->size() > cmax) 
            itc = contours.erase(itc);
        else
            ++itc;
    }

 

滤出轮廓中较大或者较小的

标签:gpo   col   ras   end   tor   max   put   while   output   

原文地址:https://www.cnblogs.com/Peit/p/8343183.html

(0)
(0)
   
举报
评论 一句话评论(0
登录后才能评论!
© 2014 mamicode.com 版权所有  联系我们:gaon5@hotmail.com
迷上了代码!