Korean license plate recognition algorithm – Python (cv2)

Korean license plate recognition algorithm – Python (cv2)


Korean Number Plate - Result

import cv2
import pytesseract
pytesseract.pytesseract.tesseract_cmd = r'C:\Program Files\Tesseract-OCR\tesseract'

# Read the image file
image = cv2.imread(r'C:\Users\user\Documents\stocks\np3.jpg')
cv2.imshow("Original", image)

# Convert to Grayscale Image
gray_image = cv2.cvtColor(image, cv2.COLOR_BGR2GRAY)

# Thresholding to get a binary image
_, thresh = cv2.threshold(gray_image, 150, 255, cv2.THRESH_BINARY_INV)

#Text Recognition with custom configuration for Korean license plates
custom_config = r'--oem 3 --psm 6 outputbase digits'
text = pytesseract.image_to_string(thresh, config=custom_config)

print("License Plate:", text)

# Display the License Plate Detection
cv2.imshow("License Plate Detection", image)


Leave a Reply

Your email address will not be published. Required fields are marked *