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
665a5d0b
Commit
665a5d0b
authored
Nov 11, 2011
by
Taddeüs Kroes
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Used native grayscale function instead of pylab.
parent
c105993c
Changes
1
Show whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
19 additions
and
27 deletions
+19
-27
src/LBP.py
src/LBP.py
+19
-27
No files found.
src/LBP.py
100644 → 100755
View file @
665a5d0b
from
pylab
import
imread
,
figure
,
show
,
imshow
,
zeros
,
axis
#!/usr/bin/python
import
Image
as
im
def
to_grayscale
(
image
):
"""Turn a RGB image to a grayscale image."""
result
=
zeros
(
image
.
shape
[:
2
])
for
x
in
xrange
(
len
(
image
)):
for
y
in
xrange
(
len
(
image
[
0
])):
result
[
x
][
y
]
=
image
[
x
][
y
].
sum
()
/
3
return
result
def
domainIterator
(
image
):
"""Iterate over the pixels of an image."""
for
y
in
xrange
(
image
.
shape
[
0
]):
for
x
in
xrange
(
image
.
shape
[
1
]):
yield
y
,
x
# Divide the examined window to cells (e.g. 16x16 pixels for each cell).
...
...
@@ -27,10 +24,5 @@ def to_grayscale(image):
# Optionally normalize the histogram. Concatenate normalized histograms of all
# cells. This gives the feature vector for the window.
image
=
imread
(
"../images/test.png"
)
image
=
to_grayscale
(
image
)
figure
()
imshow
(
image
,
cmap
=
'gray'
)
axis
(
'off'
)
show
()
image
=
im
.
open
(
"../images/test.png"
).
convert
(
'L'
)
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