/*
* =====================================================================================
*
* Filename: poly.c
*
* Description: a program of drawing the Poly
*
* Version: 1.0
* Created: 01/08/2009 03:29:49 PM
* Revision: none
* Compiler: gcc
*
* Author: Futuredaemon (BUPT), gnuhpc@gmail.com
* Company: BUPT_UNITED
*
* =====================================================================================
*/
#include <cv.h>
#include <highgui.h>
IplImage *Image1;
CvPoint PointArray1[6];
CvScalar Color;
int PolyVertexNumber;
int Shift;
int main()
{
CvSize ImageSize1 = cvSize(1000,700);
Image1 = cvCreateImage(ImageSize1, IPL_DEPTH_8U, 3);
PointArray1[0]=cvPoint(200,200);
PointArray1[1]=cvPoint(400,150);
PointArray1[2]=cvPoint(650,230);
PointArray1[3]=cvPoint(800,300);
PointArray1[4]=cvPoint(900,550);
PointArray1[5]=cvPoint(100,500);
CvScalar Color=CV_RGB(255,0,0);
PolyVertexNumber=6;
Shift=0;
cvFillConvexPoly(Image1,PointArray1,PolyVertexNumber,Color,CV_AA,Shift);
cvNamedWindow("FillConvexPoly",0);
cvShowImage("FillConvexPoly",Image1);
cvWaitKey(0);
cvSaveImage("poly.jpg",Image1);
cvReleaseImage(&Image1);
return 0;
}
opencv 多边形填充简单示例
最新推荐文章于 2024-05-21 14:46:50 发布