[opencv]拼接合并轮廓集合mergeContours

/**
 * 拼接合并轮廓集合
 * @param contours
 * @return
 */
vector<vector<Point>> mergeContours(vector<vector<Point>> contours){

    vector<vector<Point>> allcontours;
    vector<Point> contourslist;

    for (int i = 0; i < contours.size(); i++){
        vector<Point> vec_i;
        vec_i = contours[i];
        contourslist.insert(contourslist.end(),vec_i.begin(),vec_i.end());
    }
    allcontours.emplace_back(contourslist);
    return contours;
}
posted @ 2019-10-13 17:57  Xu_Lin  阅读(4115)  评论(0编辑  收藏  举报