opencv的一些函数——contours

opencv的一些函数——contours,第1张

代码如下:

//testRotateRectcpp:定义控制台应用程序的入口点。

02  //

03  #include"stdafxh"

04  #include"opencv2/opencvhpp"

05  usingnamespacestd;

06  usingnamespacecv;

07  int_tmain(intargc,_TCHARargv[])

08  {

09      Matimage(200,200,CV_8UC3,Scalar(0));

10      RotatedRectrRect=RotatedRect(Point2f(100,100),Size2f(100,50),30);//定义一个旋转矩形

11      Point2fvertices[4];

12      rRectpoints(vertices);//提取旋转矩形的四个角点

13      for(inti=0;i<4;i++)

14      {

15           line(image,vertices[i],vertices[(i+1)%4],Scalar(0,255,0));//四个角点连成线,最终形成旋转的矩形。

16      }

17      Matimg=imread("d:/fffjpg");

18      imshow("ran",image);

19      waitKey();

20      return0;

21  }

以上就是关于opencv的一些函数——contours全部的内容,包括:opencv的一些函数——contours、opencv 如何提取旋转矩形的ROI、OpenCV-Python系列八:提取图像轮廓等相关内容解答,如果想了解更多相关内容,可以关注我们,你们的支持是我们更新的动力!

欢迎分享,转载请注明来源:内存溢出

原文地址:https://54852.com/web/9268401.html

(0)
打赏 微信扫一扫微信扫一扫 支付宝扫一扫支付宝扫一扫
上一篇 2023-04-26
下一篇2023-04-26

发表评论

登录后才能评论

评论列表(0条)

    保存