0% found this document useful (0 votes)
15 views1 page

License Plate Detection in Python

The document defines variables for frame width, height, and minimum area for number plate detection. It opens a video file, sets frame properties, initializes a cascade classifier for plate detection, and enters a loop to detect plates in each frame. Plates meeting the minimum area are outlined, the ROI is saved if the user presses 's', and the scan count is incremented.

Uploaded by

Arslan Tenka
Copyright
© All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as TXT, PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
15 views1 page

License Plate Detection in Python

The document defines variables for frame width, height, and minimum area for number plate detection. It opens a video file, sets frame properties, initializes a cascade classifier for plate detection, and enters a loop to detect plates in each frame. Plates meeting the minimum area are outlined, the ROI is saved if the user presses 's', and the scan count is incremented.

Uploaded by

Arslan Tenka
Copyright
© All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as TXT, PDF, TXT or read online on Scribd

import cv2

#############################################
frameWidth = 640
frameHeight = 480
nPlateCascade =
[Link]("Resources/haarcascade_russian_plate_number.xml")
minArea = 200
color = (255,0,255)
###############################################

cap = [Link]("Resources/video12.mp4")
[Link](3, frameWidth)
[Link](4, frameHeight)
[Link](10,150)
count = 0

while True:
success, img = [Link]()
imgGray = [Link](img, cv2.COLOR_BGR2GRAY)
numberPlates = [Link](imgGray, 1.1, 10)
for (x, y, w, h) in numberPlates:
area = w*h
if area >minArea:
[Link](img, (x, y), (x + w, y + h), (255, 0, 255), 2)
[Link](img,"Number Plate",(x,y-5),
cv2.FONT_HERSHEY_COMPLEX_SMALL,1,color,2)
imgRoi = img[y:y+h,x:x+w]
[Link]("ROI", imgRoi)

[Link]("Result", img)

if [Link](1) and 0xFF == ord('s'):


[Link]("Resources/Scanned/NoPlate_"+str(count)+".jpg",imgRoi)
[Link](img,(0,200),(640,300),(0,255,0),[Link])
[Link](img,"Scan Saved",(150,265),cv2.FONT_HERSHEY_DUPLEX,
2,(0,0,255),2)
[Link]("Result",img)
[Link](500)
count +=1

You might also like