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
ed8cc82a
Commit
ed8cc82a
authored
Dec 02, 2011
by
unknown
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Jayke zijn code naar LicensePlate.py verplaatst
parent
a1848059
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
0 additions
and
84 deletions
+0
-84
src/GetPlate.py
src/GetPlate.py
+0
-65
src/GetPlateTest.py
src/GetPlateTest.py
+0
-19
No files found.
src/GetPlate.py
deleted
100644 → 0
View file @
a1848059
from
pylab
import
array
,
zeros
,
inv
,
dot
,
svd
,
shape
from
Interpolation
import
pV
def
getPlateAt
(
image
,
points
,
M
,
N
):
'''Returns an image of size MxN of the licenseplate (or any rectangular
object) defined by 4 corner points.'''
# Construct the matrix M
x1_a
,
y1_a
=
0
,
0
x2_a
,
y2_a
=
M
,
0
x3_a
,
y3_a
=
M
,
N
x4_a
,
y4_a
=
0
,
N
p_i
=
[]
for
point
in
points
:
p_i
.
append
([
point
.
x
,
point
.
y
])
mat_M
=
array
([[
p_i
[
0
][
0
],
p_i
[
0
][
1
],
1
,
0
,
0
,
0
,
\
-
x1_a
*
p_i
[
0
][
0
],
-
x1_a
*
p_i
[
0
][
1
],
-
x1_a
],
\
[
0
,
0
,
0
,
p_i
[
0
][
0
],
p_i
[
0
][
1
],
1
,
\
-
y1_a
*
p_i
[
0
][
0
],
-
y1_a
*
p_i
[
0
][
1
],
-
y1_a
],
\
[
p_i
[
1
][
0
],
p_i
[
1
][
1
],
1
,
0
,
0
,
0
,
\
-
x2_a
*
p_i
[
1
][
0
],
-
x2_a
*
p_i
[
1
][
1
],
-
x2_a
],
\
[
0
,
0
,
0
,
p_i
[
1
][
0
],
p_i
[
1
][
1
],
1
,
\
-
y2_a
*
p_i
[
1
][
0
],
-
y2_a
*
p_i
[
1
][
1
],
-
y2_a
],
\
[
p_i
[
2
][
0
],
p_i
[
2
][
1
],
1
,
0
,
0
,
0
,
\
-
x3_a
*
p_i
[
2
][
0
],
-
x3_a
*
p_i
[
2
][
1
],
-
x3_a
],
\
[
0
,
0
,
0
,
p_i
[
2
][
0
],
p_i
[
2
][
1
],
1
,
\
-
y3_a
*
p_i
[
2
][
0
],
-
y3_a
*
p_i
[
2
][
1
],
-
y3_a
],
\
[
p_i
[
3
][
0
],
p_i
[
3
][
1
],
1
,
0
,
0
,
0
,
\
-
x4_a
*
p_i
[
3
][
0
],
-
x4_a
*
p_i
[
3
][
1
],
-
x4_a
],
\
[
0
,
0
,
0
,
p_i
[
3
][
0
],
p_i
[
3
][
1
],
1
,
\
-
y4_a
*
p_i
[
3
][
0
],
-
y4_a
*
p_i
[
3
][
1
],
-
y4_a
]])
# 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 on
# the diagonal, the optimal q in min ||Dq|| is q = [[0]..[1]]. Therefore,
# p = Vq means p is the last column in V.
U
,
D
,
V
=
svd
(
mat_M
)
p
=
V
[
8
][:]
a
,
b
,
c
,
d
,
e
,
f
,
g
,
h
,
i
=
p
[
0
],
\
p
[
1
],
\
p
[
2
],
\
p
[
3
],
\
p
[
4
],
\
p
[
5
],
\
p
[
6
],
\
p
[
7
],
\
p
[
8
]
# P is the resulting matrix that describes the transformation
P
=
array
([[
a
,
b
,
c
],
\
[
d
,
e
,
f
],
\
[
g
,
h
,
i
]])
# Create the new image
b
=
array
([
zeros
(
M
,
float
)]
*
N
)
for
i
in
range
(
0
,
M
):
for
j
in
range
(
0
,
N
):
or_coor
=
dot
(
inv
(
P
),([[
i
],[
j
],[
1
]]))
or_coor_h
=
or_coor
[
1
][
0
]
/
or_coor
[
2
][
0
],
\
or_coor
[
0
][
0
]
/
or_coor
[
2
][
0
]
b
[
j
][
i
]
=
pV
(
image
,
or_coor_h
[
0
],
or_coor_h
[
1
])
return
b
src/GetPlateTest.py
deleted
100644 → 0
View file @
a1848059
from
GetPlate
import
getPlateAt
from
GrayscaleImage
import
GrayscaleImage
from
Point
import
Point
# Define the corners of the licenseplate
points
=
[
Point
(
None
,
(
310
,
383
)),
\
Point
(
None
,
(
382
,
381
)),
\
Point
(
None
,
(
382
,
396
)),
\
Point
(
None
,
(
310
,
398
))]
# Get the image
image
=
GrayscaleImage
(
'../images/test_plate.png'
)
# Let the code get the licenseplate
output_image
=
getPlateAt
(
image
,
points
,
100
,
20
)
# Show the licenseplate
output_image
=
GrayscaleImage
(
None
,
output_image
)
output_image
.
show
()
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