cvPolyLine與cvFillPoly的用法

來源:互聯網
上載者:User
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"<br />#include "cv.h"<br />#include "highgui.h"<br />int main(int argc, char* argv[])<br />{<br />char wndname[] = "Drawing Demo";<br />cvNamedWindow(wndname);<br />int arr[1];<br />arr[0] = 4;<br />CvPoint ** pt = new CvPoint*[1];<br />pt[0] = new CvPoint[4];<br />pt[0][0] = cvPoint(0,0);<br />pt[0][1] = cvPoint(100,10);<br />pt[0][2] = cvPoint(30,60);<br />pt[0][3] = cvPoint(10,100);<br />IplImage* image = cvCreateImage( cvSize(200,200), 8, 3 );<br />cvPolyLine( image, pt, arr, 1, 1, CV_RGB(250,0,0));<br />cvFillPoly(image,pt,arr,1,CV_RGB(250,0,0));<br />cvShowImage(wndname,image);<br />cvWaitKey(1000000);<br />return 0;<br />}

聯繫我們

該頁面正文內容均來源於網絡整理,並不代表阿里雲官方的觀點,該頁面所提到的產品和服務也與阿里云無關,如果該頁面內容對您造成了困擾,歡迎寫郵件給我們,收到郵件我們將在5個工作日內處理。

如果您發現本社區中有涉嫌抄襲的內容,歡迎發送郵件至: info-contact@alibabacloud.com 進行舉報並提供相關證據,工作人員會在 5 個工作天內聯絡您,一經查實,本站將立刻刪除涉嫌侵權內容。

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.