【OpenCV学习】多边形绘制

作者:gnuhpc
出处:http://www.cnblogs.com/gnuhpc/

/*
 * =====================================================================================
 *
 *       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学习】多边形绘制

 

作者:gnuhpc
出处:http://www.cnblogs.com/gnuhpc/


               作者:gnuhpc
               出处:http://www.cnblogs.com/gnuhpc/
               除非另有声明,本网站采用知识共享“署名 2.5 *”许可协议授权。


分享到:

上一篇:Ubuntu中Samba的安装配置和使用[图文]


下一篇:【心得】Web设计师应参考的技术