[英]How to recognize the narrowest part of a connected component with openCV?
Given a connected component such as this: 给定这样的连接组件:
I'd like to slice the image into two images where the narrowest part appears, so the output would look like this: 我想将图像切成两幅图像,其中出现最窄的部分,因此输出如下所示:
note: I have added few more examples (as requested):. 注意:我还添加了一些示例(根据要求):。
A really general and quite robust approach would be using erosion and watershed transformation: 一个真正通用且相当强大的方法是使用侵蚀和分水岭转换:
This will eventually result in 2 (or more) separated components. 最终将导致2个(或更多)分离的组件。 Now:
现在:
For a code reference, you may want to take a look at this watershed segmentation guide from OpenCV . 对于代码参考,您可能想看一下OpenCV的分水岭分割指南 。 They have a use case quite similar to your own application.
他们的用例与您自己的应用程序非常相似。
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.