Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
L
licenseplates
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Issues
0
Issues
0
List
Boards
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Analytics
Analytics
CI / CD
Repository
Value Stream
Wiki
Wiki
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
Taddeüs Kroes
licenseplates
Commits
3228ef58
Commit
3228ef58
authored
Dec 21, 2011
by
Taddeus Kroes
Browse files
Options
Browse Files
Download
Plain Diff
Merged conflicts.
parents
bda02c1d
82af5f4e
Changes
8
Expand all
Hide whitespace changes
Inline
Side-by-side
Showing
8 changed files
with
103 additions
and
101 deletions
+103
-101
docs/report.tex
docs/report.tex
+79
-64
src/Character.py
src/Character.py
+3
-0
src/Classifier.py
src/Classifier.py
+0
-1
src/GrayscaleImage.py
src/GrayscaleImage.py
+0
-14
src/Histogram.py
src/Histogram.py
+0
-4
src/NormalizedCharacterImage.py
src/NormalizedCharacterImage.py
+6
-4
src/create_characters.py
src/create_characters.py
+1
-0
src/xml_helper_functions.py
src/xml_helper_functions.py
+14
-14
No files found.
docs/report.tex
View file @
3228ef58
This diff is collapsed.
Click to expand it.
src/Character.py
View file @
3228ef58
...
...
@@ -8,6 +8,8 @@ class Character:
self
.
filename
=
filename
def
get_single_cell_feature_vector
(
self
,
neighbours
=
5
):
"""Get the histogram of Local Binary Patterns over this entire
image."""
if
hasattr
(
self
,
'feature'
):
return
...
...
@@ -15,6 +17,7 @@ class Character:
self
.
feature
=
pattern
.
single_cell_features_vector
()
def
get_feature_vector
(
self
,
cell_size
=
None
):
"""Get the concatenated histograms of Local Binary Patterns. """
pattern
=
LBP
(
self
.
image
)
if
cell_size
==
None
\
else
LBP
(
self
.
image
,
cell_size
)
...
...
src/Classifier.py
View file @
3228ef58
from
svmutil
import
svm_train
,
svm_problem
,
svm_parameter
,
svm_predict
,
\
svm_save_model
,
svm_load_model
,
RBF
class
Classifier
:
def
__init__
(
self
,
c
=
None
,
gamma
=
None
,
filename
=
None
,
neighbours
=
3
,
\
verbose
=
0
):
...
...
src/GrayscaleImage.py
View file @
3228ef58
...
...
@@ -22,20 +22,6 @@ class GrayscaleImage:
for
x
in
xrange
(
self
.
data
.
shape
[
1
]):
yield
y
,
x
,
self
.
data
[
y
,
x
]
#self.__i_x = -1
#self.__i_y = 0
#return self
#def next(self):
# self.__i_x += 1
# if self.__i_x == self.width:
# self.__i_x = 0
# self.__i_y += 1
# if self.__i_y == self.height:
# raise StopIteration
# return self.__i_y, self.__i_x, self[self.__i_y, self.__i_x]
def
__getitem__
(
self
,
position
):
return
self
.
data
[
position
]
...
...
src/Histogram.py
View file @
3228ef58
...
...
@@ -6,13 +6,9 @@ class Histogram:
self
.
max
=
max
def
add
(
self
,
number
):
#bin_index = self.get_bin_index(number)
#self.bins[bin_index] += 1
self
.
bins
[
number
]
+=
1
def
remove
(
self
,
number
):
#bin_index = self.get_bin_index(number)
#self.bins[bin_index] -= 1
self
.
bins
[
number
]
-=
1
def
get_bin_index
(
self
,
number
):
...
...
src/NormalizedCharacterImage.py
View file @
3228ef58
...
...
@@ -13,14 +13,16 @@ class NormalizedCharacterImage(GrayscaleImage):
self
.
blur
=
blur
self
.
gaussian_filter
()
self
.
increase_contrast
()
#
self.increase_contrast()
self
.
height
=
height
self
.
resize
()
def
increase_contrast
(
self
):
self
.
data
-=
self
.
data
.
min
()
self
.
data
=
self
.
data
.
astype
(
float
)
/
self
.
data
.
max
()
# def increase_contrast(self):
# """Increase the contrast by performing a grayscale mapping from the
# current maximum and minimum to a range between 0 and 1."""
# self.data -= self.data.min()
# self.data = self.data.astype(float) / self.data.max()
def
gaussian_filter
(
self
):
GaussianFilter
(
self
.
blur
).
filter
(
self
)
...
...
src/create_characters.py
View file @
3228ef58
...
...
@@ -80,6 +80,7 @@ def load_test_set(neighbours, blur_scale, verbose=0):
def
generate_sets
(
neighbours
,
blur_scale
,
verbose
=
0
):
"""Split the entire dataset into a trainingset and a testset."""
suffix
=
'_%s_%s'
%
(
blur_scale
,
neighbours
)
learning_set_file
=
'learning_set%s.dat'
%
suffix
test_set_file
=
'test_set%s.dat'
%
suffix
...
...
src/xml_helper_functions.py
View file @
3228ef58
...
...
@@ -125,33 +125,33 @@ def xml_to_LicensePlate(filename, save_character=None):
return
LicensePlate
(
country
,
result_characters
)
def
get_corners
(
dom
):
nodes
=
dom
.
getElementsByTagName
(
"point"
)
corners
=
[]
nodes
=
dom
.
getElementsByTagName
(
"point"
)
corners
=
[]
margin_y
=
3
margin_x
=
2
margin_y
=
3
margin_x
=
2
corners
.
append
(
corners
.
append
(
Point
(
get_coord
(
nodes
[
0
],
"x"
)
-
margin_x
,
get_coord
(
nodes
[
0
],
"y"
)
-
margin_y
)
)
)
corners
.
append
(
corners
.
append
(
Point
(
get_coord
(
nodes
[
1
],
"x"
)
+
margin_x
,
get_coord
(
nodes
[
1
],
"y"
)
-
margin_y
)
)
)
corners
.
append
(
corners
.
append
(
Point
(
get_coord
(
nodes
[
2
],
"x"
)
+
margin_x
,
get_coord
(
nodes
[
2
],
"y"
)
+
margin_y
)
)
)
corners
.
append
(
corners
.
append
(
Point
(
get_coord
(
nodes
[
3
],
"x"
)
-
margin_x
,
get_coord
(
nodes
[
3
],
"y"
)
+
margin_y
)
)
)
return
corners
return
corners
def
get_coord
(
node
,
attribute
):
return
int
(
node
.
getAttribute
(
attribute
))
return
int
(
node
.
getAttribute
(
attribute
))
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment