加载中…
个人资料
  • 博客等级:
  • 博客积分:
  • 博客访问:
  • 关注人气:
  • 获赠金笔:0支
  • 赠出金笔:0支
  • 荣誉徽章:
正文 字体大小:

opencv绘制多边形polylines及多边形填充fillPoly

(2015-07-16 01:55:44)
标签:

opencv

c

分类: 学习
#include "opencv2/core/core.hpp"
#include "opencv2/highgui/highgui.hpp"
#include "opencv2/calib3d/calib3d.hpp"
#include "opencv2/imgproc/imgproc.hpp"
#include
using namespace cv;
using namespace std;

int main(int argc, char* argv[]) 
    char name[] = "Drawing Demo"; 
    namedWindow(name); 

    Point points[1][20];  
    points[0][0] = Point( 100, 100 );
    points[0][1] = Point( 200, 100 );
    points[0][2] = Point( 250, 200 );
    points[0][3] = Point( 50, 200 );

    const Point* pt[1] = { points[0] }; 
    int npt[1] = {4};

    Mat image(300, 300, CV_8UC1, Scalar(0, 0, 0));

    polylines( image, pt, npt, 1, 1, Scalar(250,0,0)) ; 
    fillPoly( image, pt, npt, 1, Scalar(250,0,0), 8); 
    imshow(name,image);
    imwrite("1.png", image);
    waitKey(0); 
    return 0; 
}


0

阅读 收藏 喜欢 打印举报/Report
  

新浪BLOG意见反馈留言板 欢迎批评指正

新浪简介 | About Sina | 广告服务 | 联系我们 | 招聘信息 | 网站律师 | SINA English | 产品答疑

新浪公司 版权所有