Update detect.py
Browse files
detect.py
CHANGED
@@ -34,12 +34,12 @@ def detect_license_plate(image):
|
|
34 |
scale=2
|
35 |
height, width = plate.shape[:2]
|
36 |
plate = cv2.resize(plate, (width * scale, height * scale), interpolation=cv2.INTER_CUBIC)
|
37 |
-
|
38 |
-
|
39 |
-
|
40 |
-
|
41 |
-
|
42 |
-
|
43 |
|
44 |
text = reader.readtext(plate, detail=0, allowlist="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789-")
|
45 |
text = " ".join(text).upper()
|
|
|
34 |
scale=2
|
35 |
height, width = plate.shape[:2]
|
36 |
plate = cv2.resize(plate, (width * scale, height * scale), interpolation=cv2.INTER_CUBIC)
|
37 |
+
lab = cv2.cvtColor(plate, cv2.COLOR_RGB2LAB)
|
38 |
+
l, a, b = cv2.split(lab)
|
39 |
+
clahe = cv2.createCLAHE(clipLimit=3.0, tileGridSize=(8, 8))
|
40 |
+
l = clahe.apply(l)
|
41 |
+
plate = cv2.merge((l, a, b))
|
42 |
+
plate = cv2.cvtColor(plate, cv2.COLOR_LAB2RGB)
|
43 |
|
44 |
text = reader.readtext(plate, detail=0, allowlist="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789-")
|
45 |
text = " ".join(text).upper()
|