适当的轮廓中断

时间:2019-01-21 12:59:39

标签: python opencv

我想借助轮廓分析图像中的对象几何形状。这样可以确定角度和距离等参数:

enter image description here

但是有些图像看起来像这样:

enter image description here enter image description here enter image description here enter image description here

我正在尝试在两个对象之间创建轮廓,问题是对象的大小不固定。他们可以更改其长度和形状。结果,轮廓断裂在错误的位置进行,因此无法进行适当的分析。现在,轮廓中断与下部物体的尺寸有关。这是正确的休息时间的样子:

enter image description here

有什么办法解决这个问题吗?

编辑:

带有输入图像的文件夹: https://ufile.io/v6fqs

示例:

enter image description here enter image description here enter image description here

1 个答案:

答案 0 :(得分:4)

感谢示例和精心设计的问题。

这确实是一个大问题,甚至考虑医学成像时也是如此。在我看来,答案就在于斑点检测和分离方法。

一个好的方法是进行二值化,形态转换并搜索凸度缺陷(https://docs.opencv.org/master/d3/dc0/group__imgproc__shape.html#gada4437098113fd8683c932e0567f47ba)。

convexityDefects =  cv.convexityDefects(contour, convexhull[, convexityDefects] )

我还认为该线程也可以为您提供帮助:

http://answers.opencv.org/question/71691/single-blob-multiple-objects-ideas-on-how-to-separate-objects/