I working on a project that will read licence plates, my plan is
- Converting the image to grayscale for better performance
- Use Histogram equalizer to bring out the licence plate characters
- Blur the image to remove some noise
- Use adaptive threshold to binaries the image
- Use open and close morphology
- Detect the rectangular bounding box for the licence plate
Well, the issue is: my code is not so good, the result is so bad I cannot detect the rectangle, below is my code:
Imgproc.cvtColor(image, image, Imgproc.COLOR_BGR2GRAY, 0);
Imgproc.blur(image, image, new Size(3, 3));
Imgproc.equalizeHist(image, image);
Mat openElem = Imgproc.getStructuringElement(Imgproc.MORPH_RECT, new Size(1, 1));
Mat closeElem = Imgproc.getStructuringElement(Imgproc.MORPH_RECT, new Size(1, 1));
Imgproc.adaptiveThreshold(image, image, 225, Imgproc.ADAPTIVE_THRESH_GAUSSIAN_C, Imgproc.THRESH_BINARY_INV, 11, 2);
The input image:
The output image:
If anyone with experience would help I will appreciate