c# opencv 轮廓检测_在opencv上检测非闭合轮廓

在计算机视觉项目中进行自动卡片检测时,需要从背景中分离卡片。应用Canny边缘检测后,有时会出现不完美的边缘,导致OpenCV无法检测到有“孔”的轮廓。可以通过调整cvFindContour参数或使用Otsu阈值化、形态学操作、watershed算法或Hough变换来解决这个问题。
摘要由CSDN通过智能技术生成

I'm doing computer vision project for automatic card detection.

I need to separate the card from the background. I have applied the canny edge detection, using automatic parameter settings from this

The result is excellent. However, sometimes the canny is not perfect like this

I have applied cvFindContour to detect the box. However, due to "hole" on the upper side, opencv failed to detect the contour.

How do I tune the cvFindContour to detect the contour or should I tune the canny edge instead?

解决方案

There are multiple possible solutions.

The simplest one may be:

if FindContours does not find a closed contour, repeat the canny filter with a slightly decreased low_threshold, until you find a closed contour. If the closed contour has roughly the right size and shape, it is a card.

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值