【问题标题】:OpenCV - Finding pixel coordinate from center of contours using pythonOpenCV - 使用python从轮廓中心查找像素坐标
【发布时间】:2017-06-22 13:43:58
【问题描述】:

我是 python 和 OpenCV 的新手。我只想找到轮廓中心检测到的对象图像的像素坐标。

提前谢谢你。任何帮助将不胜感激。

通过搜索,我发现了这样的内容:

coord = np.where(np.all(img == (0, 0, 255), axis=-1))
print zip(coord[0], coord[1])

此示例使用 OpenCV 和 python 找到对象的中心:

http://www.pyimagesearch.com/2016/02/01/opencv-center-of-contour/

【问题讨论】:

  • 搞笑你!!!!你是唯一一个在你的问题中提到了答案并且仍然期待答案的人
  • 我不知道该把代码放在哪里..
  • 在找到所有轮廓后添加。首先找到你的轮廓,然后在 for 循环中运行它

标签: python-2.7 opencv numpy image-processing opencv-contour


【解决方案1】:

使用cv2.minEnclosingCircle(contour) 计算轮廓的最小包围圆。
Here 是文档。

【讨论】:

    猜你喜欢
    • 1970-01-01
    • 1970-01-01
    • 2011-06-13
    • 2017-11-11
    • 1970-01-01
    • 1970-01-01
    • 2018-09-09
    • 2015-07-24
    • 1970-01-01
    相关资源
    最近更新 更多