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
efcd73a6
Commit
efcd73a6
authored
Nov 18, 2011
by
Richard Torenvliet
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
start on cropping of a characters
parent
7bc52ab8
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
36 additions
and
0 deletions
+36
-0
src/crop.py
src/crop.py
+36
-0
No files found.
src/crop.py
0 → 100644
View file @
efcd73a6
from
PIL
import
Image
from
Pylab
import
*
from
LBP
import
domain_iterator
THRESHOLD
=
0.5
im
=
Image
.
open
(
'../.jpg'
)
im
=
Image
.
convert
(
'L'
,
im
)
outer_bounds
=
get_outer_bounds
()
im
.
crop
(
outer_bounds
)
imshow
(
im
)
show
()
def
get_outer_bound
():
min_x
=
len
(
im
[
0
])
max_x
=
0
min_y
=
len
(
im
)
max_y
=
0
for
y
in
xrange
(
len
(
im
)):
for
x
in
xrange
(
len
(
im
[
0
])):
if
im
[
y
,
x
]
>
THRESHOLD
:
if
x
<
min_x
:
min_x
=
x
if
y
<
min_y
:
min_y
=
y
if
x
>
max_x
:
max_x
=
x
if
y
>
max_y
:
max_y
=
y
return
(
min_x
,
min_y
,
max_x
,
max_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