【问题标题】:retrieve contour using fillpoly in opencv c++在opencv c ++中使用fillpoly检索轮廓
【发布时间】:2014-04-12 05:42:27
【问题描述】:

我在 opencv c++ new platform 中遇到了一个非常棘手的问题。 我想在 opencv 2.4.7 中使用 fillpoly 检索图像掩码,但每次都会出现语法错误。请帮我粘贴我的代码

vecpt是opencv中cv::Point数据类型的向量,它持有一些坐标位置。

现在我想从用户选择的标记点位置检索轮廓蒙版

int num = (int)vecpt.size();
        Point *pt4 = new Point[num];
        for(int i=0;i<num;i++)
        {
            pt4->x=vecpt[i].x;
            pt4->y=vecpt[i].y;


        }


        fillPoly(img2,&pt4,&num,1,Scalar(0,255,0),8);

我收到以下错误:

Error -- No matching function in fillpoly

我多次更改参数的所有类型,但每次都失败。 请帮帮我。

【问题讨论】:

    标签: c++ opencv image-processing


    【解决方案1】:

    哦,那些讨厌的指针;)

    我想,你可以不用任何副本就离开:

    vector<Point> vecpt;
    int num = (int)vecpt.size();
    
    const Point * pt4 = &(vecpt[0]); // *@#! const
    
    fillPoly(img2,&pt4,&num,1,Scalar(0,255,0),8);
    

    【讨论】:

      猜你喜欢
      • 2014-07-12
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 2016-03-27
      • 1970-01-01
      相关资源
      最近更新 更多