opencv 3.0 填充矩形 填充多边形 fillPoly

来源:互联网 发布:中行外汇分析软件 编辑:程序博客网 时间:2024/05/22 10:39

http://blog.csdn.net/billbliss/article/details/43968291

opencv中没有旋转矩形,也没有填充矩形
原来它封装了一个 填充多边形fillPoly()

不多说上代码

[cpp] view plain copy
  1. void drawpoly()  
  2. {  
  3.     Mat img(500, 500, CV_8U, Scalar(0));  
  4.   
  5.     Point root_points[1][4];  
  6.     root_points[0][0] = Point(215,220);  
  7.     root_points[0][1] = Point(460,225);  
  8.     root_points[0][2] = Point(466,450);  
  9.     root_points[0][3] = Point(235,465);  
  10.   
  11.     const Point* ppt[1] = {root_points[0]};  
  12.     int npt[] = {4};  
  13.     polylines(img, ppt, npt, 1, 1, Scalar(255),1,8,0);  
  14.     imshow("Test", img);  
  15.     waitKey();  
  16.     fillPoly(img, ppt, npt, 1, Scalar(255));  
  17.     imshow("Test", img);  
  18.     waitKey();  
  19. }  


结果如图



原创粉丝点击