Commit 292aefd4 authored by Richard Torenvliet's avatar Richard Torenvliet

Merge branch 'master' of github.com:taddeus/licenseplates

parents b063255e 6f5f0e40
RM=rm -rf
all: plan.pdf report.pdf
plan.pdf: plan.tex
pdflatex $^
report.pdf: report.tex
pdflatex $^
clean:
$(RM) *.pdf *.aux *.log *.out *.toc
......@@ -16,7 +16,7 @@
\section*{Project members}
Gijs van der Voort\\
Richard Torenvliet\\
Raichard Torenvliet\\
Jayke Meijer\\
Tadde\"us Kroes\\
Fabi\"en Tesselaar
......
......@@ -2,6 +2,7 @@ from Histogram import Histogram
from math import ceil
class LocalBinaryPatternizer:
"""This class generates a Local Binary Pattern of a given image."""
def __init__(self, image, cell_size=16, neighbours=3):
self.cell_size = cell_size
......@@ -23,6 +24,7 @@ class LocalBinaryPatternizer:
self.histograms[i].append(Histogram(self.bins, 0, self.bins))
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) \
| (self.is_pixel_darker(y - 1, x , value) << 6) \
| (self.is_pixel_darker(y - 1, x + 1, value) << 5) \
......@@ -33,6 +35,7 @@ class LocalBinaryPatternizer:
| (self.is_pixel_darker(y , x - 1, 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) \
| (self.is_pixel_darker(y - 2, x , value) << 6) \
| (self.is_pixel_darker(y - 2, x + 2, value) << 5) \
......@@ -43,6 +46,7 @@ class LocalBinaryPatternizer:
| (self.is_pixel_darker(y , x - 2, 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) \
| (self.is_pixel_darker(y , x - 2, value) << 10) \
| (self.is_pixel_darker(y + 1, x - 2, value) << 9) \
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment