简体   繁体   English

如何在轮廓OpenCV中找到“区域”?

[英]How to find “regions” in a contour OpenCV?

Say we have the following contour information from OpenCV contours: 假设我们从OpenCV轮廓获取以下轮廓信息:

在此处输入图片说明

What I mean by a "region" is a subset of the contour with low directional variation. 我所说的“区域”是轮廓的子集,方向变化很小。

So for example these, could be regions in the provided example: 因此,例如,这些可能是所提供示例中的区域:

在此处输入图片说明

One way to detect these could be, doing a local neighborhoud comparison of the dot products of the tangent at each point. 一种检测这些现象的方法是,对每个点处的切线的点积进行局部邻居比较。 (ie see how much the tangent changes locally). (即查看切线局部变化)。

I was wondering however if there is a better way to do this, using OpenCV directly rather than doing vector operations myself. 但是我想知道是否还有更好的方法,直接使用OpenCV而不是自己执行向量运算。

-When your region boundaries are always near-vertical or near-horizontal, consider preprocessing the image using a filter (erode, dilate), to isolate vertices and horices, then merge results, to find an alternating color on region boundaries. -当区域边界总是接近垂直或接近水平时,请考虑使用滤镜(腐蚀,扩张)对图像进行预处理,以分离顶点和地平线,然后合并结果,以在区域边界上找到交替的颜色。

-When your directions go anywhere, it's more complicated ! -当您的路线到达任何地方时,情况都会更加复杂! One option would be to retrieve coordinates from your pixels with the help of Hough lines see 一种选择是借助霍夫线见从像素中检索坐标

https://opencv-python-tutroals.readthedocs.io/en/latest/py_tutorials/py_imgproc/py_houghlines/py_houghlines.html https://opencv-python-tutroals.readthedocs.io/en/latest/py_tutorials/py_imgproc/py_houghlines/py_houghlines.html

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM