#include "stdafx.h"
#include <iostream>
#include <cv.h>
#include <highgui.h>
#include <vector>
using namespace cv;
using namespace std;
void MyPolygon( Mat& img );
int _tmain(int argc, _TCHAR* argv[])
{
Mat img = imread("d://1.jpg");
namedWindow("Test",CV_WINDOW_AUTOSIZE);
MyPolygon(img);
imshow("Test", img);
waitKey(0);
return 0;
}
void MyPolygon( Mat& img )
{
/** Create some points */
Point rook_points[1][20];
rook_points[0][3] = Point( 100, 10 );
rook_points[0][0] = Point(10, 10 );
rook_points[0][1] = Point( 20, 100 );
rook_points[0][2] = Point( 100, 200 );
const Point* ppt[1] = { rook_points[0] };
int npt[] = { 4 };
//fillPoly( img, ppt,npt,1,Scalar( 0, 255, 255 ),8 );
polylines(img,ppt,npt,1,1,CV_RGB(0,255,0),2,8,0);
}
OpenCv fillPoly polylines
最新推荐文章于 2023-12-19 12:14:58 发布