I’m working on a license plate detection project which is mostly for educational purposes.
I have gone through some process to locate the license plate and applied perspective transform upon the points of the plate rectangle.
Current issue: I can’t seem to find a proper way to segment characters.
I have tried morphological operations but it sometimes ends up with some extra contours that I can’t distinguish them from actual characters.
Usually there is a segment on the left of the plate or the lines on the right both of which I have marked on the image below:
Code:
mask = cv2.adaptiveThreshold(
ex_plate, 255, cv2.ADAPTIVE_THRESH_MEAN_C, cv2.THRESH_BINARY_INV, 17, 5
)
mask = cv2.morphologyEx(mask, cv2.MORPH_OPEN, np.ones((3, 3)))
marker = cv2.erode(mask, cv2.getStructuringElement(cv2.MORPH_RECT, (4, 20)))
obr = open_by_reconstruction(marker, mask)
obr = clear_border(obr)
obr = cv2.morphologyEx(obr, cv2.MORPH_CLOSE, np.ones((3, 3)))
obr = hole_filler(obr)
These plates are labeled with correct plate number and I wanted to segment the characters so that I can train a model to identify them.
And this will be the pipeline for each image before reaching the model.