The usage of cvpolyline and Cvfillpoly

Source: Internet
Author: User
1, Cvpolyline draw simple or diverse polygons.
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 image.
An array of vertex pointers for the PTS polyline.
An array of fixed-point numbers for npts polylines. It can also be thought of as the size of the PTS pointer array
The number of segments of the contours polyline.
Is_closed Indicates whether the polygon is closed. If closed, the function connects the starting and ending points.
The color of a color polyline.
Thickness the thickness of the line.
The type of the Line_type segment. See Cvline.
The number of decimal places for the shift vertex.

2. Cvfillpoly is used to fill a single area bounded by a polygon contour.

 Functions can populate complex areas, such as vulnerable areas and areas with intersections, and so on. void Cvfillpoly (cvarr* img, cvpoint** pts, int* npts, int contours,cvscalar color, int line_type=8, int shift=0);

IMG image.
The PTS pointer to an array of polygons.
An array of the number of vertices of the npts polygon.
Contours the number of segments that make up the filled area.
The color of the color polygon.
Line_type the type of line that makes up the polygon.
shift          the number of decimal places for vertex coordinates. View plain Copy to clipboard print? #include   "stdafx.h"    #include   "cv.h"    #include   "highgui.h"    int  main (int argc, char* argv[])    {   char wndname[] =  " Drawing demo ";   Cvnamedwindow (wndname);   int arr[1];   arr[0] =  4;   cvpoint ** pt = new cvpoint*[1];   pt[0] = new  CvPoint[4];   pt[0][0] = cvpoint (0,0);   Pt[0][1] = cvpoint (100,10 );   Pt[0][2] = cvpoint (30,60);   pt[0][3] = cvpoint (10,100);    Iplimage* image = cvcreateimage ( cvsize (200,200), 8, 3 );   Cvpolyline ( image, pt, arr, 1, 1, cv_rgb (250,0,0));   CvFillPoly (image, PtArr,1,cv_rgb (250,0,0));   cvshowimage (wndname,image);   Cvwaitkey (1000000);   return 0;  }  


Go from: http://blog.sina.com.cn/s/blog_7db0d7ff0100ur2p.html


Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

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.