Android OpenCV边缘检测

问题描述:

我在Android上使用OpenCV进行车牌识别。作为该过程的一部分,我使用Canny边缘检测来查找图像中的边缘。我遇到的问题是图像中的水平边缘没有被检测为实线。的问题是,由于线不是固体我不能将其检测为一个轮廓Android OpenCV边缘检测

这是我正在运行上

enter image description here

此边缘检测图像的边缘检测的结果。正如你所看到的,车牌的垂直边缘已经被检测为实线,但水平线是虚线的。

enter image description here

这是我的代码

 org.opencv.imgproc.Imgproc.Canny(snapshot.getImage(), dst, 
      Configurator.PlateDetectCannyThreshold1, 
      Configurator.PlateDetectCannyThreshold2, 
      Configurator.PlateDetectCannyApperture); 
    List<Mat> contours = new Vector<Mat>(); 
    org.opencv.imgproc.Imgproc.findContours(dst, contours, new Mat(), 
      org.opencv.imgproc.Imgproc.CV_RETR_LIST, 
      org.opencv.imgproc.Imgproc.CV_CHAIN_APPROX_SIMPLE, 
      new org.opencv.core.Point(0, 0)); 
+0

您在坎尼坏阈值。降低他们一点。 – Sam 2012-03-21 14:18:05

+0

我试过了。我应该提到我的上限是300,上面的图像是下限是0,但是我已经将上面的图像逐渐降低到0,并且没有区别 – 2012-03-21 14:36:24

+0

上限应该设置在40左右的某个位置上120,下限为0.4 *上限或上限/ 3。我认为读一点总是很好的。 google上的'wiki canny',以及阅读canny如何工作。这很重要 – Sam 2012-03-21 14:42:34

一个快速和肮脏溶液将使用如所描述的here形态学闭运算。

形态闭合操作有助于填补小缺口。

我遇到了类似的问题,当我实现文档边缘检测和使用形态扩张边缘更好的检测:

Mat kernel = Imgproc.getStructuringElement(Imgproc.MORPH_DILATE, new Size(3,3), new Point(1,1)); 
Imgproc.dilate(mIntermediateMat, mIntermediateMat, kernel); 
+0

你能分享你执行的步骤吗? – RBK 2016-10-12 08:47:39

+0

@RBK请参阅[Square Detectction](http://*.com/questions/8667818/opencv-c-obj-c-detecting-a-sheet-of-paper-square-detection?rq=1)它非常好地描述了这些步骤。 – Shailesh 2016-10-13 16:47:47