【问题标题】:ordering points of a contour轮廓的排序点
【发布时间】:2012-05-10 17:56:58
【问题描述】:

我通过以下方式检测到一个矩形:

  1. 寻找轮廓
  2. 近似多边形

然后我试图找到矩形的角为:

imgPoints[0]=contours_poly[i][0];  
imgPoints[1]=contours_poly[i][1];  
imgPoints[3]=contours_poly[i][3];  
imgPoints[2]=contours_poly[i][2]; 

由于参考点,我想以预定义的顺序对这些点进行排序。假设我想从 0 点开始,我该如何订购 以前的积​​分?

【问题讨论】:

    标签: c++ image-processing opencv


    【解决方案1】:

    如果您计算从点0 到点xy 的向量,它们的cross product 将告诉您向量更逆时针。

    代码示例was given in the question "Sort four points in the clockwise order"

    【讨论】:

      猜你喜欢
      • 2021-09-14
      • 2013-05-29
      • 2017-01-17
      • 1970-01-01
      • 1970-01-01
      • 2012-11-09
      • 1970-01-01
      • 1970-01-01
      • 2022-07-20
      相关资源
      最近更新 更多