-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathtestDoubleHaar.py
executable file
·42 lines (36 loc) · 1.34 KB
/
testDoubleHaar.py
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
"""
Trying to apply twice haar detection to a plate to narrow down the character region only
DID NOT SUCCEED
"""
import sys
from rekkariDetectionSave import DetectPlate
from filterImage import FilterImage
from filterCharacterRegions import FilterCharacterRegions
from initialCharacterRegions import InitialCharacterRegions
from myTesseract import MyTesseract
import glob
# image to plate(s)
files=glob.glob(sys.argv[1])
print(files)
if len(files)==0:
raise FileNotFoundError('no files with search term: '+sys.argv[1])
for file in files:
# 1 image to possible plates
app1 = DetectPlate(imageFileName=file)
plates = app1.getNpPlates()
app1.showPlates()
print(file+' number of plates found '+ str(len(plates)))
for plate in plates:
# from a plate image to list of six-rectangles
#app2 = FilterImage(npImage=plate)
#plate = app2.filterOtsu()
app3 = FilterCharacterRegions(npImage=plate)
platesWithCharacterRegions = app3.imageToPlatesWithCharacterRegions()
app5 = MyTesseract()
app5.setImage(plate)
#app3.showImage()
app5.defineSixPlateCharacters(platesWithCharacterRegions,lang='eng')
print("PLATE, confidence, char conf:", \
app5.getFinalString(), \
app5.getFinalPlateConfidence(), \
app5.getFinalCharacterConfidences() )