cvPolyLine与cvFillPoly的用法

1、cvPolyLine 绘制简单或多样的多边形。
void cvPolyLine( CvArr* img, CvPoint** pts, int* npts, int contours, int is_closed,
                                                   CvScalar color, int thickness=1, int line_type=8, int shift=0 );
img           图像。
pts             折线的顶点指针数组。
npts       折线的定点个数数组。也可以认为是pts指针数组的大小
contours     折线的线段数量。
is_closed   指出多边形是否封闭。如果封闭,函数将起始点和结束点连线。
color                 折线的颜色。
thickness   线条的粗细程度。
line_type   线段的类型。参见cvLine。
shift                   顶点的小数点位数。

2、cvFillPoly用于一个单独被多边形轮廓所限定的区域内进行填充。函数可以填充复杂的区域,例如,有漏洞的区域和有交叉点的区域等等。
void cvFillPoly( CvArr* img, CvPoint** pts, int* npts, int contours,CvScalar color, int line_type=8, int shift=0 );
img                    图像。
pts                     指向多边形的数组指针。
npts                 多边形的顶点个数的数组。
contours     组成填充区域的线段的数量。
color                 多边形的颜色。
line_type   组成多边形的线条的类型。
shift                   顶点坐标的小数点位数。
 
#include  "stdafx.h"    
  1. #include "cv.h"   
  2. #include "highgui.h"   
  3. int main(int argc, char* argv[])  
  4.  
  5. char wndname[] "Drawing Demo";  
  6. cvNamedWindow(wndname);  
  7. int arr[1];  
  8. arr[0] 4;  
  9. CvPoint ** pt new CvPoint*[1];  
  10. pt[0] new CvPoint[4];  
  11. pt[0][0] cvPoint(0,0);  
  12. pt[0][1] cvPoint(100,10);  
  13. pt[0][2] cvPoint(30,60);  
  14. pt[0][3] cvPoint(10,100);  
  15. IplImage* image cvCreateImage( cvSize(200,200), 8, );  
  16. cvPolyLine( image, pt, arr, 1, 1, CV_RGB(250,0,0));  
  17. cvFillPoly(image,pt,arr,1,CV_RGB(250,0,0));  
  18. cvShowImage(wndname,image);  
  19. cvWaitKey(1000000);  
  20. return 0;  
  21.  
  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值