opencv-fillPoly填充的多边形
cv::Mat img(500, 500, CV_8UC3, cv::Scalar(0,0,0)); cv::Point root_points[1][4]; root_points[0][0] = cv::Point(215, 220); root_points[0][1] = cv::Point(460, 225); root_points[0][2] = cv::Point(466, 450); root_points[0][3] = cv::Point(235, 465); const cv::Point* ppt[1] = { root_points[0] }; int npt[] = { 4 }; cv::fillPoly(img, ppt, npt, 1, cv::Scalar(255,0,0)); /* 参数1:作为画布的矩阵 参数2:pts 折线顶点数组 参数3:npts 折线顶点个数 参数4:待绘制折线数 参数5:折线的颜色 */ imshow("Test", img); cv::waitKey();