根据点画多边形

来源:互联网 发布:淘宝店铺怎么打开 编辑:程序博客网 时间:2024/04/30 08:01
#include <cstdio>#include <opencv2/opencv.hpp>using namespace cv;int main(){    //Mat img(400, 400, CV_8UC3, Scalar(255,255,255));   Mat img=imread("1.jpg");    Mat_<Vec3b> m2 = img;Point points[1][4];    points[0][0] = Point(90, 180);    points[0][1] = Point(240, 130);    points[0][2] = Point(230, 240);    points[0][3] = Point(60, 240);    const Point* ppt[1] = {points[0]};    int npt[] = {4};    polylines(img, ppt, npt, 1, 1, Scalar(0,255,255),4);    imshow("window", img);imshow("window2", m2);    waitKey(0);     return 0;}