博客
关于我
技巧 | OpenCV中如何绘制与填充多边形
阅读量:322 次
发布时间:2019-03-04

本文共 2668 字,大约阅读时间需要 8 分钟。

OpenCV ????????????

? OpenCV ??????????????????????????????????????????????????????? polylines ??? thickness ?????????????????????????????????????????????????????????????? OpenCV ???????????????


?????

? OpenCV ??polylines ????????????????????? thickness ?????????????????

  • ? thickness ?????????????????
  • ? thickness ?????????????????????

???? polylines ?????????????????????????????????????????????


polylines ????

??????? polylines ?????????????

Mat canvas = Mat::zeros(Size(512, 512), CV_8UC3);
int w = canvas.cols;
int h = canvas.rows;
Point p1(100, 100);
Point p2(300, 150);
Point p3(300, 350);
Point p4(250, 450);
Point p5(50, 450);
std::vector
pts;
pts.push_back(p1);
pts.push_back(p2);
pts.push_back(p3);
pts.push_back(p3);
pts.push_back(p4);
pts.push_back(p5);
polylines(canvas, pts, true, Scalar(0, 255, 0), 1, LINE_8, 0);

??????????????????????????


?????

???????????????? fillPoly ?????????? polylines ???????????????????fillPoly ?????? polylines ????????????? fillPoly ??? thickness ? isClosed ???

fillPoly ????

??????? fillPoly ?????????????

Mat canvas = Mat::zeros(Size(512, 512), CV_8UC3);
int w = canvas.cols;
int h = canvas.rows;
Point p1(100, 100);
Point p2(300, 150);
Point p3(300, 350);
Point p4(250, 450);
Point p5(50, 450);
std::vector
pts;
pts.push_back(p1);
pts.push_back(p2);
pts.push_back(p3);
pts.push_back(p3);
pts.push_back(p4);
pts.push_back(p5);
fillPoly(canvas, pts, Scalar(255, 0, 255), 8, 0);
polylines(canvas, pts, true, Scalar(0, 255, 255), 2, LINE_8, 0);

???????????????????????????


?????????????

?? fillPoly ???OpenCV ???? drawContours ??????????? fillPoly ??????????????????????????drawContours ??????????

  • image??????????
  • contours??????????
  • contourIdx???????????????? -1 ?????????
  • color??????
  • thickness???????????????????

drawContours ????

??????? drawContours ????????????????

Mat canvas = Mat::zeros(Size(512, 512), CV_8UC3);
int w = canvas.cols;
int h = canvas.rows;
Point p1(100, 100);
Point p2(300, 150);
Point p3(300, 350);
Point p4(250, 450);
Point p5(50, 450);
std::vector
> contours;
contours.push_back(pts);
drawContours(canvas, contours, 0, Scalar(0, 0, 255), -1, 8);
drawContours(canvas, contours, 0, Scalar(255, 0, 255), 2, 8);

?????????????????????????????????????


????

??????????????????????????????? fillPoly ? drawContours ???????

  • fillPoly ?????????????????????????
  • drawContours ?????????????????????????????????
  • ?????????????????????????????????


    OpenCV ????

    ??? OpenCV ??????????????????????????????? OpenCV ???????????????????????????????????????????OpenCV ????20??????????????


    ???????????????????????????????????? SLAM??????????????????????????????????????????+??/??+?????

    转载地址:http://adaq.baihongyu.com/

    你可能感兴趣的文章
    Mysql 索引问题集锦
    查看>>
    Mysql 纵表转换为横表
    查看>>
    mysql 编译安装 window篇
    查看>>
    mysql 网络目录_联机目录数据库
    查看>>
    MySQL 聚簇索引&&二级索引&&辅助索引
    查看>>
    Mysql 脏页 脏读 脏数据
    查看>>
    mysql 自增id和UUID做主键性能分析,及最优方案
    查看>>
    Mysql 自定义函数
    查看>>
    mysql 行转列 列转行
    查看>>
    Mysql 表分区
    查看>>
    mysql 表的操作
    查看>>
    mysql 视图,视图更新删除
    查看>>
    MySQL 触发器
    查看>>
    mysql 让所有IP访问数据库
    查看>>
    mysql 记录的增删改查
    查看>>
    MySQL 设置数据库的隔离级别
    查看>>
    MySQL 证明为什么用limit时,offset很大会影响性能
    查看>>
    Mysql 语句操作索引SQL语句
    查看>>
    MySQL 误操作后数据恢复(update,delete忘加where条件)
    查看>>
    MySQL 调优/优化的 101 个建议!
    查看>>