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
957cba5c
Commit
957cba5c
authored
Dec 22, 2011
by
Taddeus Kroes
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Renamed 'LearningSet' folder to 'characters'.
parent
9e6af877
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
13 additions
and
4 deletions
+13
-4
src/data.py
src/data.py
+1
-1
src/xml_helper_functions.py
src/xml_helper_functions.py
+12
-3
No files found.
src/data.py
View file @
957cba5c
...
...
@@ -3,7 +3,7 @@ from cPickle import load, dump
DATA_FOLDER
=
'data/'
IMAGES_FOLDER
=
'../images/
LearningSet
/'
IMAGES_FOLDER
=
'../images/
characters
/'
RESULTS_FOLDER
=
'results/'
...
...
src/xml_helper_functions.py
View file @
957cba5c
...
...
@@ -6,6 +6,8 @@ from Character import Character
from
GrayscaleImage
import
GrayscaleImage
from
NormalizedCharacterImage
import
NormalizedCharacterImage
from
LicensePlate
import
LicensePlate
from
data
import
IMAGES_FOLDER
# Gets the character data from a picture with a license plate
def
retrieve_data
(
plate
,
corners
):
...
...
@@ -38,6 +40,7 @@ def retrieve_data(plate, corners):
return
data
def
get_transformation_matrix
(
matrix
):
# Get the vector p and the values that are in there by taking the SVD.
# Since D is diagonal with the eigenvalues sorted from large to small
...
...
@@ -48,6 +51,7 @@ def get_transformation_matrix(matrix):
return
inv
(
array
([[
p
[
0
],
p
[
1
],
p
[
2
]],
[
p
[
3
],
p
[
4
],
p
[
5
]],
[
p
[
6
],
p
[
7
],
p
[
8
]]]))
def
pV
(
image
,
x
,
y
):
#Get the value of a point (interpolated x, y) in the given image
if
not
image
.
in_bounds
(
x
,
y
):
...
...
@@ -67,6 +71,7 @@ def pV(image, x, y):
+
image
[
x_low
,
y_high
]
/
x_y
*
a
*
d
\
+
image
[
x_high
,
y_high
]
/
x_y
*
c
*
d
def
xml_to_LicensePlate
(
filename
,
save_character
=
None
):
plate
=
GrayscaleImage
(
'../images/Images/%s.jpg'
%
filename
)
dom
=
parse
(
'../images/Infos/%s.info'
%
filename
)
...
...
@@ -100,10 +105,10 @@ def xml_to_LicensePlate(filename, save_character=None):
data
=
retrieve_data
(
plate
,
corners
)
image
=
NormalizedCharacterImage
(
data
=
data
)
result
.
append
(
Character
(
value
,
corners
,
image
,
filename
))
if
save_character
:
character_image
=
GrayscaleImage
(
data
=
data
)
path
=
"../images/LearningSet/%s"
%
value
path
=
IMAGES_FOLDER
+
value
image_path
=
"%s/%d_%s.jpg"
%
(
path
,
i
,
filename
.
split
(
'/'
)[
-
1
])
if
not
exists
(
path
):
...
...
@@ -114,15 +119,19 @@ def xml_to_LicensePlate(filename, save_character=None):
return
LicensePlate
(
country
,
result
)
def
get_node
(
node
,
tag
):
return
by_tag
(
node
,
tag
)[
0
].
firstChild
.
data
def
by_tag
(
node
,
tag
):
return
node
.
getElementsByTagName
(
tag
)
def
get_attr
(
node
,
attr
):
return
int
(
node
.
getAttribute
(
attr
))
def
get_corners
(
dom
):
p
=
by_tag
(
dom
,
"point"
)
...
...
@@ -134,4 +143,4 @@ def get_corners(dom):
return
get_attr
(
p
[
0
],
"x"
)
-
x
,
get_attr
(
p
[
0
],
"y"
)
-
y
,
\
get_attr
(
p
[
1
],
"x"
)
+
x
,
get_attr
(
p
[
1
],
"y"
)
-
y
,
\
get_attr
(
p
[
2
],
"x"
)
+
x
,
get_attr
(
p
[
2
],
"y"
)
+
y
,
\
get_attr
(
p
[
3
],
"x"
)
-
x
,
get_attr
(
p
[
3
],
"y"
)
+
y
\ No newline at end of file
get_attr
(
p
[
3
],
"x"
)
-
x
,
get_attr
(
p
[
3
],
"y"
)
+
y
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