OpenCv fillPoly polylines
来源:互联网 发布:ubuntu默认字体是什么 编辑:程序博客网 时间:2024/06/05 05:47
#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);}