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
d2e524ef
Commit
d2e524ef
authored
Dec 09, 2011
by
Taddeus Kroes
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Fixed ranges.
parent
de262d05
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
16 additions
and
15 deletions
+16
-15
.gitignore
.gitignore
+1
-0
src/LearningSetGenerator.py
src/LearningSetGenerator.py
+15
-15
No files found.
.gitignore
View file @
d2e524ef
...
@@ -10,6 +10,7 @@
...
@@ -10,6 +10,7 @@
*.nav
*.nav
*.snm
*.snm
*.jpg
*.jpg
*.zip
images/BBB
images/BBB
images/Images
images/Images
images/Infos
images/Infos
...
...
src/LearningSetGenerator.py
View file @
d2e524ef
...
@@ -23,7 +23,7 @@ class LearningSetGenerator:
...
@@ -23,7 +23,7 @@ class LearningSetGenerator:
M
=
int
(
1.2
*
(
max
(
x0
,
x1
,
x2
,
x3
)
-
min
(
x0
,
x1
,
x2
,
x3
)))
M
=
int
(
1.2
*
(
max
(
x0
,
x1
,
x2
,
x3
)
-
min
(
x0
,
x1
,
x2
,
x3
)))
N
=
max
(
y0
,
y1
,
y2
,
y3
)
-
min
(
y0
,
y1
,
y2
,
y3
)
N
=
max
(
y0
,
y1
,
y2
,
y3
)
-
min
(
y0
,
y1
,
y2
,
y3
)
matrix
=
array
([
matrix
=
array
([
[
x0
,
y0
,
1
,
0
,
0
,
0
,
0
,
0
,
0
],
[
x0
,
y0
,
1
,
0
,
0
,
0
,
0
,
0
,
0
],
[
0
,
0
,
0
,
x0
,
y0
,
1
,
0
,
0
,
0
],
[
0
,
0
,
0
,
x0
,
y0
,
1
,
0
,
0
,
0
],
...
@@ -88,43 +88,43 @@ class LearningSetGenerator:
...
@@ -88,43 +88,43 @@ class LearningSetGenerator:
def
read_xml
(
self
,
filename
):
def
read_xml
(
self
,
filename
):
dom
=
parse
(
'../images/Infos/%s.info'
%
filename
)
dom
=
parse
(
'../images/Infos/%s.info'
%
filename
)
self
.
characters
=
[]
self
.
characters
=
[]
version
=
dom
.
getElementsByTagName
(
"current-version"
)[
0
].
firstChild
.
data
version
=
dom
.
getElementsByTagName
(
"current-version"
)[
0
].
firstChild
.
data
info
=
dom
.
getElementsByTagName
(
"info"
)
info
=
dom
.
getElementsByTagName
(
"info"
)
for
i
in
info
:
for
i
in
info
:
if
version
==
i
.
getElementsByTagName
(
"version"
)[
0
].
firstChild
.
data
:
if
version
==
i
.
getElementsByTagName
(
"version"
)[
0
].
firstChild
.
data
:
self
.
country
=
i
.
getElementsByTagName
(
"identification-letters"
)[
0
].
firstChild
.
data
self
.
country
=
i
.
getElementsByTagName
(
"identification-letters"
)[
0
].
firstChild
.
data
temp
=
i
.
getElementsByTagName
(
"characters"
)
temp
=
i
.
getElementsByTagName
(
"characters"
)
if
len
(
temp
):
if
len
(
temp
):
characters
=
temp
[
0
].
childNodes
characters
=
temp
[
0
].
childNodes
else
:
else
:
self
.
characters
=
[]
self
.
characters
=
[]
break
break
for
i
,
character
in
enumerate
(
characters
):
for
i
,
character
in
enumerate
(
characters
):
if
character
.
nodeName
==
"character"
:
if
character
.
nodeName
==
"character"
:
value
=
character
.
getElementsByTagName
(
"char"
)[
0
].
firstChild
.
data
value
=
character
.
getElementsByTagName
(
"char"
)[
0
].
firstChild
.
data
corners
=
self
.
get_corners
(
character
)
corners
=
self
.
get_corners
(
character
)
if
not
len
(
corners
)
==
4
:
if
not
len
(
corners
)
==
4
:
break
break
image
=
GrayscaleImage
(
data
=
self
.
retrieve_data
(
corners
))
image
=
GrayscaleImage
(
data
=
self
.
retrieve_data
(
corners
))
print
value
print
value
path
=
"../images/LearningSet/%s"
%
value
path
=
"../images/LearningSet/%s"
%
value
image_path
=
"%s/%d_%s.jpg"
%
(
path
,
i
,
filename
.
split
(
'/'
)[
-
1
])
image_path
=
"%s/%d_%s.jpg"
%
(
path
,
i
,
filename
.
split
(
'/'
)[
-
1
])
if
not
exists
(
path
):
if
not
exists
(
path
):
mkdir
(
path
)
mkdir
(
path
)
if
not
exists
(
image_path
):
if
not
exists
(
image_path
):
image
.
save
(
image_path
)
image
.
save
(
image_path
)
break
break
def
get_corners
(
self
,
dom
):
def
get_corners
(
self
,
dom
):
...
@@ -136,13 +136,13 @@ class LearningSetGenerator:
...
@@ -136,13 +136,13 @@ class LearningSetGenerator:
corners
.
append
(
Point
(
node
))
corners
.
append
(
Point
(
node
))
return
corners
return
corners
for
i
in
range
(
1
):
for
j
in
range
(
1
):
for
i
in
range
(
9
):
for
j
in
range
(
100
):
try
:
try
:
filename
=
'%04d/00991_%04d%02d.info'
%
(
i
,
i
,
j
)
filename
=
'%04d/00991_%04d%02d.info'
%
(
i
,
i
,
j
)
print
'loading file "%s"'
%
filename
print
'loading file "%s"'
%
filename
plate
=
LearningSetGenerator
(
i
,
j
)
plate
=
LearningSetGenerator
(
i
,
j
)
except
:
except
:
print
"failure"
print
"failure"
\ No newline at end of file
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