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
85c8eaae
Commit
85c8eaae
authored
Dec 21, 2011
by
Taddeus Kroes
Browse files
Options
Browse Files
Download
Plain Diff
Merge branch 'master' of github.com:taddeus/licenseplates
parents
7756e8e1
6f5f0e40
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
5 additions
and
1 deletion
+5
-1
src/LocalBinaryPatternizer.py
src/LocalBinaryPatternizer.py
+5
-1
No files found.
src/LocalBinaryPatternizer.py
View file @
85c8eaae
...
@@ -2,7 +2,8 @@ from Histogram import Histogram
...
@@ -2,7 +2,8 @@ from Histogram import Histogram
from
math
import
ceil
from
math
import
ceil
class
LocalBinaryPatternizer
:
class
LocalBinaryPatternizer
:
"""This class generates a Local Binary Pattern of a given image."""
def
__init__
(
self
,
image
,
cell_size
=
16
,
neighbours
=
3
):
def
__init__
(
self
,
image
,
cell_size
=
16
,
neighbours
=
3
):
self
.
cell_size
=
cell_size
self
.
cell_size
=
cell_size
self
.
image
=
image
self
.
image
=
image
...
@@ -23,6 +24,7 @@ class LocalBinaryPatternizer:
...
@@ -23,6 +24,7 @@ class LocalBinaryPatternizer:
self
.
histograms
[
i
].
append
(
Histogram
(
self
.
bins
,
0
,
self
.
bins
))
self
.
histograms
[
i
].
append
(
Histogram
(
self
.
bins
,
0
,
self
.
bins
))
def
pattern_3x3
(
self
,
y
,
x
,
value
):
def
pattern_3x3
(
self
,
y
,
x
,
value
):
"""Create the Local Binary Pattern in the (8,3)-neighbourhood."""
return
(
self
.
is_pixel_darker
(
y
-
1
,
x
-
1
,
value
)
<<
7
)
\
return
(
self
.
is_pixel_darker
(
y
-
1
,
x
-
1
,
value
)
<<
7
)
\
|
(
self
.
is_pixel_darker
(
y
-
1
,
x
,
value
)
<<
6
)
\
|
(
self
.
is_pixel_darker
(
y
-
1
,
x
,
value
)
<<
6
)
\
|
(
self
.
is_pixel_darker
(
y
-
1
,
x
+
1
,
value
)
<<
5
)
\
|
(
self
.
is_pixel_darker
(
y
-
1
,
x
+
1
,
value
)
<<
5
)
\
...
@@ -33,6 +35,7 @@ class LocalBinaryPatternizer:
...
@@ -33,6 +35,7 @@ class LocalBinaryPatternizer:
|
(
self
.
is_pixel_darker
(
y
,
x
-
1
,
value
))
|
(
self
.
is_pixel_darker
(
y
,
x
-
1
,
value
))
def
pattern_5x5_hybrid
(
self
,
y
,
x
,
value
):
def
pattern_5x5_hybrid
(
self
,
y
,
x
,
value
):
"""Create the Local Binary Pattern in the (8,5)-neighbourhood."""
return
(
self
.
is_pixel_darker
(
y
-
2
,
x
-
2
,
value
)
<<
7
)
\
return
(
self
.
is_pixel_darker
(
y
-
2
,
x
-
2
,
value
)
<<
7
)
\
|
(
self
.
is_pixel_darker
(
y
-
2
,
x
,
value
)
<<
6
)
\
|
(
self
.
is_pixel_darker
(
y
-
2
,
x
,
value
)
<<
6
)
\
|
(
self
.
is_pixel_darker
(
y
-
2
,
x
+
2
,
value
)
<<
5
)
\
|
(
self
.
is_pixel_darker
(
y
-
2
,
x
+
2
,
value
)
<<
5
)
\
...
@@ -43,6 +46,7 @@ class LocalBinaryPatternizer:
...
@@ -43,6 +46,7 @@ class LocalBinaryPatternizer:
|
(
self
.
is_pixel_darker
(
y
,
x
-
2
,
value
))
|
(
self
.
is_pixel_darker
(
y
,
x
-
2
,
value
))
def
pattern_5x5
(
self
,
y
,
x
,
value
):
def
pattern_5x5
(
self
,
y
,
x
,
value
):
"""Create the Local Binary Pattern in the (12,5)-neighbourhood."""
return
(
self
.
is_pixel_darker
(
y
-
1
,
x
-
2
,
value
)
<<
11
)
\
return
(
self
.
is_pixel_darker
(
y
-
1
,
x
-
2
,
value
)
<<
11
)
\
|
(
self
.
is_pixel_darker
(
y
,
x
-
2
,
value
)
<<
10
)
\
|
(
self
.
is_pixel_darker
(
y
,
x
-
2
,
value
)
<<
10
)
\
|
(
self
.
is_pixel_darker
(
y
+
1
,
x
-
2
,
value
)
<<
9
)
\
|
(
self
.
is_pixel_darker
(
y
+
1
,
x
-
2
,
value
)
<<
9
)
\
...
...
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