pep8. Documenatation correction.

This commit is contained in:
dan
2015-06-12 07:49:00 +02:00
parent 360d384633
commit 68f627aca7
3 changed files with 20 additions and 28 deletions
@@ -10,11 +10,11 @@ The features are calculated similarly to local binary patterns (LBPs),
except that summed blocks are used instead of individual pixel values.
MB-LBP is an extension of LBP that can be computed on multiple scales
in constant time using the integral image.
9 equally-sized rectangles are used to compute a feature.
For each rectangle, the sum of the pixel intensities is computed.
Comparisons of these sums to that of the central rectangle determine
the feature, similarly to LBP (See `LBP <plot_local_binary_pattern.html>`_).
in constant time using the integral image. 9 equally-sized rectangles
are used to compute a feature. For each rectangle, the sum of the pixel
intensities is computed. Comparisons of these sums to that of the central
rectangle determine the feature, similarly to LBP
(See `LBP <plot_local_binary_pattern.html>`_).
First, we generate an image to illustrate the functioning of MB-LBP:
we take a (9, 9) rectangle and divide it into (3, 3) block,
@@ -25,6 +25,7 @@ upon which we then apply MB-LBP.
from __future__ import print_function
from skimage.feature import multiblock_local_binary_pattern
import numpy as np
from numpy.testing import assert_equal
from skimage.transform import integral_image
# Create test matrix where first and fifth
@@ -35,17 +36,16 @@ test_img[3:6, 3:6] = 1
test_img[:3, :3] = 50
test_img[6:, 6:] = 50
# MB-LBP is filled in reverse order.
# So the first and fifth bits from the end should
# be filled.
# First and fifth bits should be filled.
# This correct value will be compared to
# the computed one.
correct_answer = 0b10001000
int_img = integral_image(test_img)
lbp_code = multiblock_local_binary_pattern(int_img, 0, 0, 3, 3)
print(correct_answer)
print(lbp_code)
assert_equal(correct_answer, lbp_code)
"""
Now let's apply the operator to a real image and see how the visualization works.
@@ -71,6 +71,6 @@ plt.imshow(img, interpolation='nearest')
On the above plot we see the result of computing a MB-LBP and visualization
of the computed feature. The rectangles that have less intensity than the central
rectangle are marked in cyan. The ones that have bigger intensity values
rectangle are marked in cyan. The ones that have higher intensity values
are marked in white. The central rectangle is left untouched.
"""