Spaces:
Sleeping
Sleeping
Update classifier.py
Browse files- classifier.py +10 -6
classifier.py
CHANGED
|
@@ -14,20 +14,24 @@ from tensorflow.keras.models import load_model
|
|
| 14 |
# copied_image2 = original_image.copy()
|
| 15 |
#img = cv2.imread('car3.jpg')
|
| 16 |
|
| 17 |
-
|
|
|
|
| 18 |
|
| 19 |
def my_function(uploaded_file):
|
| 20 |
-
|
|
|
|
|
|
|
|
|
|
| 21 |
|
| 22 |
# Loads the data required for detecting the license plates from cascade classifier.
|
| 23 |
plate_cascade = cv2.CascadeClassifier('indian_license_plate.xml')
|
| 24 |
|
| 25 |
|
| 26 |
def detect_plate(img, text=''): # the function detects and perfors blurring on the number plate.
|
| 27 |
-
|
| 28 |
-
|
| 29 |
-
plate_img = Image.open(img)
|
| 30 |
-
roi = Image.open(img)
|
| 31 |
|
| 32 |
|
| 33 |
plate_rect = plate_cascade.detectMultiScale(plate_img, scaleFactor = 1.2, minNeighbors = 7) # detects numberplates and returns the coordinates and dimensions of detected license plate's contours.
|
|
|
|
| 14 |
# copied_image2 = original_image.copy()
|
| 15 |
#img = cv2.imread('car3.jpg')
|
| 16 |
|
| 17 |
+
#img = cv2.imread(imagePath)
|
| 18 |
+
#gray = cv2.cvtColor(img, cv2.COLOR_BGR2RGB)
|
| 19 |
|
| 20 |
def my_function(uploaded_file):
|
| 21 |
+
|
| 22 |
+
img = cv2.imread(uploaded_file)
|
| 23 |
+
gray = cv2.cvtColor(img, cv2.COLOR_BGR2RGB)
|
| 24 |
+
#img = Image.open(uploaded_file)
|
| 25 |
|
| 26 |
# Loads the data required for detecting the license plates from cascade classifier.
|
| 27 |
plate_cascade = cv2.CascadeClassifier('indian_license_plate.xml')
|
| 28 |
|
| 29 |
|
| 30 |
def detect_plate(img, text=''): # the function detects and perfors blurring on the number plate.
|
| 31 |
+
plate_img = img.copy()
|
| 32 |
+
roi = img.copy()
|
| 33 |
+
#plate_img = Image.open(img)
|
| 34 |
+
#roi = Image.open(img)
|
| 35 |
|
| 36 |
|
| 37 |
plate_rect = plate_cascade.detectMultiScale(plate_img, scaleFactor = 1.2, minNeighbors = 7) # detects numberplates and returns the coordinates and dimensions of detected license plate's contours.
|