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
34d11f9d
Commit
34d11f9d
authored
13 years ago
by
Jayke Meijer
Browse files
Options
Downloads
Patches
Plain Diff
Modified GetPlate and GetPlateTest to handle Point datatype instead of raw coordinates.
parent
c6ab9323
No related branches found
Branches containing commit
No related tags found
No related merge requests found
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
src/GetPlate.py
+23
-10
23 additions, 10 deletions
src/GetPlate.py
src/GetPlateTest.py
+4
-7
4 additions, 7 deletions
src/GetPlateTest.py
with
27 additions
and
17 deletions
src/GetPlate.py
+
23
−
10
View file @
34d11f9d
from
pylab
import
array
,
zeros
,
inv
,
dot
,
svd
,
shape
from
Interpolation
import
pV
def
getPlateAt
(
image
,
x1
,
y1
,
x2
,
y2
,
x3
,
y3
,
x4
,
y4
,
M
,
N
):
def
getPlateAt
(
image
,
points
,
M
,
N
):
'''
Returns an image of size MxN of the licenseplate (or any rectangular
object) defined by
the
corner points
(x1, y1) to (x4, y4)
.
'''
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
mat_M
=
array
([[
x1
,
y1
,
1
,
0
,
0
,
0
,
-
x1_a
*
x1
,
-
x1_a
*
y1
,
-
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
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
...
...
This diff is collapsed.
Click to expand it.
src/GetPlateTest.py
+
4
−
7
View file @
34d11f9d
from
GetPlate
import
getPlateAt
from
GrayscaleImage
import
GrayscaleImage
from
Point
import
Point
# Define the coordinates of the licenseplate
x_vals
=
[
310
,
382
,
382
,
310
]
y_vals
=
[
383
,
381
,
396
,
398
]
# 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
,
x_vals
[
0
],
y_vals
[
0
],
\
x_vals
[
1
],
y_vals
[
1
],
\
x_vals
[
2
],
y_vals
[
2
],
\
x_vals
[
3
],
y_vals
[
3
],
100
,
20
)
output_image
=
getPlateAt
(
image
,
points
,
100
,
20
)
# Show the licenseplate
output_image
=
GrayscaleImage
(
None
,
output_image
)
...
...
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