Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
L
licenseplates
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Wiki
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Build
Pipelines
Jobs
Pipeline schedules
Artifacts
Deploy
Releases
Model registry
Operate
Environments
Monitor
Incidents
Analyze
Value stream analytics
Contributor analytics
CI/CD analytics
Repository analytics
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Keyboard shortcuts
?
Snippets
Groups
Projects
This is an archived project. Repository and other project resources are read-only.
Show more breadcrumbs
Taddeüs Kroes
licenseplates
Commits
957cba5c
Commit
957cba5c
authored
13 years ago
by
Taddeus Kroes
Browse files
Options
Downloads
Patches
Plain Diff
Renamed 'LearningSet' folder to 'characters'.
parent
9e6af877
No related branches found
No related tags found
No related merge requests found
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
src/data.py
+1
-1
1 addition, 1 deletion
src/data.py
src/xml_helper_functions.py
+12
-3
12 additions, 3 deletions
src/xml_helper_functions.py
with
13 additions
and
4 deletions
src/data.py
+
1
−
1
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/
'
...
...
This diff is collapsed.
Click to expand it.
src/xml_helper_functions.py
+
12
−
3
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
This diff is collapsed.
Click to expand it.
Preview
0%
Loading
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Save comment
Cancel
Please
register
or
sign in
to comment