// TestFillPoly.cpp : Defines the entry point for the console application.
//
#include "stdafx.h"
#include <cv.h>
#include <cvcam.h>
#include <cxcore.h>
#include <highgui.h>
#pragma comment(lib,"cv.lib")
#pragma comment(lib,"cvcam.lib")
#pragma comment(lib,"cxcore.lib")
#pragma comment(lib,"highgui.lib")
#define nMatWidth 400
#define nMatHeight 400
int main(int argc, char* argv[])
{
//假设需要用到的数据
CvPoint szPoint1[5] = { {78,65}, {102,234}, {368,173}, {126,32}, {45,164} };
CvPoint szPoint2[6] = { {89,323}, {0,134}, {171,262}, {126,32}, {85,85},{75,69} };
CvPoint szPoint3[7] = { {78,65}, {102,234}, {368,173}, {126,32}, {12,56}, {320,172}, {95,32} };
CvPoint *pSzArray[] = {szPoint1, szPoint2, szPoint3};
int nArrayNumber[] = {5,6,7};
//创建矩阵
CvMat *Mat = cvCreateMat(nMatWidth,nMatHeight,CV_8UC3);
assert(Mat != NULL);
//绘制多边形
cvFillPoly(Mat,pSzArray,nArrayNumber,3,CV_RGB(255,255,255));
//显示图像
cvNamedWindow("Show_Result");
cvShowImage("Show_Result",Mat);
cvWaitKey();
//释放资源
cvReleaseMat(&Mat);
cvDestroyWindow("Show_Resulst");
return 0;
}