Reputation: 2431
I am using OpenCV on Android for doing number plate recognition. As part of the process I am using Canny edge detection to find the edges within the image. The problem I am having is that the horizontal edges within the image are not being detected as solid lines. The problems is that because the lines are not solid I cannot detect it as one contour
This is the image that I am running the edge detection on
This is the result of the edge detection. As you can see the vertical edges of the number plate have been detected as solid lines but the horizontals are dotted.
Here is my code
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));
Upvotes: 1
Views: 7798
Reputation: 131
I ran into similar problem when i implement document edge detection and used Morphology to dilate the edge for better detection:
Mat kernel = Imgproc.getStructuringElement(Imgproc.MORPH_DILATE, new Size(3,3), new Point(1,1));
Imgproc.dilate(mIntermediateMat, mIntermediateMat, kernel);
Upvotes: 2
Reputation: 11256
A quick and dirty solution would be using morphological closing operation as described here.
Morphological closing operation helps filling small gaps.
Upvotes: 1