检测到 Opencv 轮廓中断
Opencv contours detected discontinue
我正在使用 openCV 检测图像中的矩形。在许多示例中,我使用 threshold+findContours+approxPolyDP。
如下图,我的问题是findContours找到的轮廓不连续,所以在approxPolyDP之后,我无法得到一个矩形...
那么,你知道如何解决这个问题吗?谢谢你。 :)
另一个问题:为什么轮廓是灰色的?阈值处理后,应该只有白色和黑色,不是吗?
C++: void approxPolyDP(InputArray curve, OutputArray approxCurve,
double epsilon, bool closed)
epsilon – Parameter specifying the approximation accuracy. This is the
maximum distance between the original curve and its approximation.
尝试增加 epsilon
我正在使用 openCV 检测图像中的矩形。在许多示例中,我使用 threshold+findContours+approxPolyDP。
如下图,我的问题是findContours找到的轮廓不连续,所以在approxPolyDP之后,我无法得到一个矩形...
那么,你知道如何解决这个问题吗?谢谢你。 :)
另一个问题:为什么轮廓是灰色的?阈值处理后,应该只有白色和黑色,不是吗?
C++: void approxPolyDP(InputArray curve, OutputArray approxCurve, double epsilon, bool closed)
epsilon – Parameter specifying the approximation accuracy. This is the maximum distance between the original curve and its approximation.
尝试增加 epsilon