我是OpenCV与Android的新手。我目前正在研究文档检测演示应用程序。我所做的,只要下面是:OpenCV - canny边缘检测不能正常工作
原图 - >灰度图像 - >高斯模糊 - >Canny边缘检测 - >寻找轮廓 - >画轮廓
我可以完美地检测出纸张,如下图所示。
但它不能检测某些文件。下面是他们
之一,我研究了很多关于这一点,发现问题出在Canny边缘检测和下面是精明的形象:
正如你所看到的,边缘检测并不完美,并且在某个点不连接边缘。这就是原因。
我已经通过类似的问题在:How to select the best set of parameters in Canny Edge detection algorithm implemented in OpenCV? 我已经按照解决方案,但它没有为我工作。
我的精明的检测代码如下:
double otsu_thresold = Imgproc.threshold(mGray,edged,0,255, Imgproc.THRESH_OTSU);
Imgproc.Canny(mRgba, edged, otsu_thresold*0.5,otsu_thresold);
我不知道我错了!我应该怎么做才能完美检测文档?
为了增强边缘使用**形态学扩张**。请参阅[本页](http://opencv-python-tutroals.readthedocs.io/en/latest/py_tutorials/py_imgproc/py_morphological_ops/py_morphological_ops.html#morphological-ops)。 –